Bug 205922 - editors/libreoffice: Does not end on Ctrl-Q or file menu (version 5.0.4)
Summary: editors/libreoffice: Does not end on Ctrl-Q or file menu (version 5.0.4)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: FreeBSD Office Team (Nobody)
URL:
Keywords: needs-qa
: 206773 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-01-05 14:00 UTC by Matthias Apitz
Modified: 2016-02-08 18:31 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (office)


Attachments
1/3 (1.50 KB, patch)
2016-02-05 21:02 UTC, Matthias Apitz
no flags Details | Diff
2/3 (2.50 KB, patch)
2016-02-05 21:03 UTC, Matthias Apitz
no flags Details | Diff
3/3 (805 bytes, patch)
2016-02-05 21:04 UTC, Matthias Apitz
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Apitz 2016-01-05 14:00:22 UTC
this is on r292778 and ports r404859, amd64 all compiled from head; just start:

$ libreoffice

and exit from the file menu or with Ctrl-Q; the proc haengst forever; a ps shows:

15970  3  I+     0:00,05 /usr/local/lib/libreoffice/program/oosplash
15985  3  I+     0:00,85 /usr/local/lib/libreoffice/program/soffice.bin --splas

Ctrl-C end the proc.
Comment 1 Matthias Apitz 2016-02-03 13:30:21 UTC
I watched with truss(1) what the soffice.bin proc is doing after receiving Ctrl-Q:
it's closing all filedescriptors, trying to send some SHUTDOWN into some socket and hangs for ever in this calls:

close(10)					 = 0 (0x0)
munmap(0x800769000,670842)			 = 0 (0x0)
close(9)					 = 0 (0x0)
munmap(0x80075a000,57362)			 = 0 (0x0)
close(7)					 = 0 (0x0)
lstat("/usr/home/guru/.config/libreoffice/4/.lock",{ mode=-rw-r--r-- ,inode=18629985,size=137,blksize=32768 }) = 0 (0x0)
unlink("/usr/home/guru/.config/libreoffice/4/.lock") = 0 (0x0)
shutdown(8,SHUT_RDWR)				 ERR#57 'Socket is not connected'
close(8)					 = 0 (0x0)
unlink("/tmp/OSL_PIPE_1001_SingleOfficeIPC_78ab5adf6fd91c539d475f9513c71017") = 0 (0x0)
_umtx_op(0x800736080,UMTX_OP_WAIT_UINT_PRIVATE,0x0,0x18,0x7fffdf5f8e58) ERR#60 'Operation timed out'
_umtx_op(0x800736008,UMTX_OP_WAIT_UINT_PRIVATE,0x0,0x18,0x7fffdfffded8) ERR#60 'Operation timed out'
_umtx_op(0x800736080,UMTX_OP_WAIT_UINT_PRIVATE,0x0,0x18,0x7fffdf5f8e38) ERR#60 'Operation timed out'
munmap(0x8021fe000,4096)			 = 0 (0x0)
_umtx_op(0x800736008,UMTX_OP_WAIT_UINT_PRIVATE,0x0,0x18,0x7fffdfffded8) ERR#60 'Operation timed out'
Comment 2 Matthias Apitz 2016-02-03 18:03:07 UTC
see also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206773
Comment 3 Matthias Apitz 2016-02-05 21:00:29 UTC
the problem is caused by closing the socket file descriptors in one thread, while another thread is still in accept(2) on the same socket and this is not canceled in the OS; the same is true for pipes; I'm attaching patches for this to be placed in editors/libreoffice/files;
Comment 4 Matthias Apitz 2016-02-05 21:02:30 UTC
Created attachment 166629 [details]
1/3
Comment 5 Matthias Apitz 2016-02-05 21:03:39 UTC
Created attachment 166630 [details]
2/3
Comment 6 Matthias Apitz 2016-02-05 21:04:28 UTC
Created attachment 166631 [details]
3/3
Comment 7 Tijl Coosemans freebsd_committer 2016-02-08 09:14:41 UTC
I can reproduce the problem with the systray icon disabled and the patches fix it.  The upstream patches only change the behaviour for sockets, not pipes.  Was there still a problem if you only changed it for sockets?
Comment 8 Tijl Coosemans freebsd_committer 2016-02-08 09:16:22 UTC
*** Bug 206773 has been marked as a duplicate of this bug. ***
Comment 9 Matthias Apitz 2016-02-08 10:16:10 UTC
w/o the patch for sal/osl/unx/pipe.cxx one of the libreoffice threads hangs in accept(2) sys call, coming down from osl_acceptPipe(); see the gdbbacktrace:


(no debugging symbols found)...(no debugging symbols found)...[New LWP 100085]
[New Thread 816215000 (LWP 100085/soffice.bin)]
[New Thread 816216400 (LWP 101356/soffice.bin)]

Program received signal SIGINT, Interrupt.
[Switching to Thread 816215000 (LWP 100085/soffice.bin)]
0x00000008010c821c in _umtx_op_err () from /lib/libthr.so.3
Current language:  auto; currently minimal
#0  0x00000008010c821c in _umtx_op_err () from /lib/libthr.so.3
#1  0x00000008010c505c in join_common (pthread=0x816216800, thread_return=0x0, abstime=0x0) at /usr/local/r292778/src/lib/libthr/thread/thr_join.c:125
#2  0x0000000800ab8193 in ?? () from /usr/local/lib/libreoffice/program/libsofficeapp.so
#3  0x0000000800a8f280 in ?? () from /usr/local/lib/libreoffice/program/libsofficeapp.so
#4  0x0000000806012551 in DeInitVCL () from /usr/local/lib/libreoffice/program/libvcllo.so
#5  0x0000000806011e7b in VclResId () from /usr/local/lib/libreoffice/program/libvcllo.so
#6  0x0000000806012978 in SVMain () from /usr/local/lib/libreoffice/program/libvcllo.so
#7  0x0000000800abc91e in soffice_main () from /usr/local/lib/libreoffice/program/libsofficeapp.so
#8  0x0000000000400870 in ?? ()
#9  0x000000000040077f in ?? ()
#10 0x0000000800621000 in ?? ()
#11 0x0000000000000000 in ?? ()
[New Thread 81dbe7c00 (LWP 101484/soffice.bin)]
[New Thread 816216800 (LWP 101477/soffice.bin)]
[New Thread 816215c00 (LWP 101353/soffice.bin)]

Thread 6 (Thread 816215c00 (LWP 101353/soffice.bin)):
#0  0x00000008010c821c in _umtx_op_err () from /lib/libthr.so.3
#1  0x00000008010be276 in _thr_umtx_timedwait_uint (mtx=0x800736008, id=<value optimized out>, clockid=<value optimized out>, abstime=<value optimized out>, shared=0) at /usr/local/r292778/src/lib/libthr/thread/thr_umtx.c:212
#2  0x00000008010c665d in cond_wait_common (cond=<value optimized out>, mutex=<value optimized out>, abstime=0x7fffdfffdf78, cancel=0) at /usr/local/r292778/src/lib/libthr/thread/thr_cond.c:258
#3  0x0000000800836fb1 in rtl_secureZeroMemory () from /usr/local/lib/libreoffice/program/libuno_sal.so.3
#4  0x00000008010bc824 in thread_start (curthread=0x816215c00) at /usr/local/r292778/src/lib/libthr/thread/thr_create.c:288
#5  0x0000000000000000 in ?? ()

Thread 5 (Thread 816216800 (LWP 101477/soffice.bin)):
#0  0x0000000800de541a in _accept () from /lib/libc.so.7
#1  0x00000008010be936 in __thr_accept (s=12, addr=0x0, addrlen=0x0) at /usr/local/r292778/src/lib/libthr/thread/thr_syscalls.c:106
#2  0x000000080085982b in osl_acceptPipe () from /usr/local/lib/libreoffice/program/libuno_sal.so.3
#3  0x0000000800abb902 in ?? () from /usr/local/lib/libreoffice/program/libsofficeapp.so
#4  0x0000000800abadee in ?? () from /usr/local/lib/libreoffice/program/libsofficeapp.so
#5  0x00000008032d4bce in salhelper::Thread::run () from /usr/local/lib/libreoffice/program/libuno_salhelpergcc3.so.3
#6  0x00000008032d4d8f in non-virtual thunk to salhelper::Thread::onTerminated() () from /usr/local/lib/libreoffice/program/libuno_salhelpergcc3.so.3
#7  0x000000080086247e in osl_setThreadTextEncoding () from /usr/local/lib/libreoffice/program/libuno_sal.so.3
#8  0x00000008010bc824 in thread_start (curthread=0x816216800) at /usr/local/r292778/src/lib/libthr/thread/thr_create.c:288
#9  0x0000000000000000 in ?? ()

Thread 4 (Thread 81dbe7c00 (LWP 101484/soffice.bin)):
#0  0x0000000800df6fea in _poll () from /lib/libc.so.7
#1  0x00000008010bed86 in __thr_poll (fds=0x81e40e030, nfds=2, timeout=-1) at /usr/local/r292778/src/lib/libthr/thread/thr_syscalls.c:306
#2  0x00000008181ffb1d in SessionManagerClient::getSessionID () from /usr/local/lib/libreoffice/program/libvclplug_genlo.so
#3  0x000000080086247e in osl_setThreadTextEncoding () from /usr/local/lib/libreoffice/program/libuno_sal.so.3
#4  0x00000008010bc824 in thread_start (curthread=0x81dbe7c00) at /usr/local/r292778/src/lib/libthr/thread/thr_create.c:288
#5  0x0000000000000000 in ?? ()

Thread 2 (Thread 816215000 (LWP 100085/soffice.bin)):
#0  0x00000008010c821c in _umtx_op_err () from /lib/libthr.so.3
#1  0x00000008010c505c in join_common (pthread=0x816216800, thread_return=0x0, abstime=0x0) at /usr/local/r292778/src/lib/libthr/thread/thr_join.c:125
#2  0x0000000800ab8193 in ?? () from /usr/local/lib/libreoffice/program/libsofficeapp.so
#3  0x0000000800a8f280 in ?? () from /usr/local/lib/libreoffice/program/libsofficeapp.so
#4  0x0000000806012551 in DeInitVCL () from /usr/local/lib/libreoffice/program/libvcllo.so
#5  0x0000000806011e7b in VclResId () from /usr/local/lib/libreoffice/program/libvcllo.so
#6  0x0000000806012978 in SVMain () from /usr/local/lib/libreoffice/program/libvcllo.so
#7  0x0000000800abc91e in soffice_main () from /usr/local/lib/libreoffice/program/libsofficeapp.so
#8  0x0000000000400870 in ?? ()
#9  0x000000000040077f in ?? ()
#10 0x0000000800621000 in ?? ()
#11 0x0000000000000000 in ?? ()
Comment 10 commit-hook freebsd_committer 2016-02-08 18:30:10 UTC
A commit references this bug:

Author: tijl
Date: Mon Feb  8 18:29:37 UTC 2016
New revision: 408494
URL: https://svnweb.freebsd.org/changeset/ports/408494

Log:
  Add upstream patches that resolve a deadlock when one thread closes a
  socket or pipe while another thread is still accepting connections.

  PR:		205922
  Approved by:	office (jkim)

Changes:
  head/editors/libreoffice/Makefile.common
  head/editors/libreoffice/files/patch-sal_osl_unx_pipe.cxx
  head/editors/libreoffice/files/patch-sal_osl_unx_socket.cxx
  head/editors/libreoffice/files/patch-sal_osl_unx_sockimpl.hxx