From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#9216: Signal handling and pthreads Date: Mon, 01 Aug 2011 13:44:09 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT X-Trace: dough.gmane.org 1312220689 22641 80.91.229.12 (1 Aug 2011 17:44:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Aug 2011 17:44:49 +0000 (UTC) To: 9216@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 01 19:44:45 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QnwXk-0000rV-L0 for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Aug 2011 19:44:44 +0200 Original-Received: from localhost ([::1]:48326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnwXj-0001zj-VJ for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Aug 2011 13:44:43 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnwXg-0001xh-SF for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2011 13:44:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QnwXf-0000bz-Kt for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2011 13:44:40 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnwXf-0000bu-Hw for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2011 13:44:39 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QnwY2-0001iN-Jb; Mon, 01 Aug 2011 13:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Aug 2011 17:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9216 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13122206826544 (code B ref -1); Mon, 01 Aug 2011 17:45:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Aug 2011 17:44:42 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QnwXh-0001hU-7H for submit@debbugs.gnu.org; Mon, 01 Aug 2011 13:44:42 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QnwXe-0001hN-4v for submit@debbugs.gnu.org; Mon, 01 Aug 2011 13:44:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QnwXF-0000YC-Ue for submit@debbugs.gnu.org; Mon, 01 Aug 2011 13:44:14 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:48903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnwXF-0000Y8-TA for submit@debbugs.gnu.org; Mon, 01 Aug 2011 13:44:13 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:47825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnwXE-0001Gw-Tf for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2011 13:44:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QnwXD-0000Xd-J0 for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2011 13:44:12 -0400 Original-Received: from relais.videotron.ca ([24.201.245.36]:55874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnwXD-0000XT-EA for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2011 13:44:11 -0400 Original-Received: from ceviche.home ([96.22.109.87]) by vl-mh-mrz21.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTP id <0LP9007NKFW8RC10@vl-mh-mrz21.ip.videotron.ca> for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2011 13:43:20 -0400 (EDT) Original-Received: by ceviche.home (Postfix, from userid 20848) id 07CDD660CF; Mon, 01 Aug 2011 13:44:09 -0400 (EDT) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 01 Aug 2011 13:45:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:49757 Archived-At: In syssignal.h we have: #if defined (HAVE_GTK_AND_PTHREAD) || defined (HAVE_NS) #include /* If defined, asynchronous signals delivered to a non-main thread are forwarded to the main thread. */ #define FORWARD_SIGNAL_TO_MAIN_THREAD #endif But that is not right: the test should bot be for HAVE_NS and HAVE_GTK, but just for using pthreads. There are more ways to get pthreads involved. E.g. I just got the following assertion failure: #0 abort () at emacs.c:381 #1 0x08373ba2 in die ( msg=0x860ae8c "assertion failed: handling_signal == 0", file=0x8603867 "keyboard.c", line=7183) at alloc.c:6232 #2 0x082be485 in input_available_signal (signo=29) at keyboard.c:7183 #3 #4 0xb7fe2424 in __kernel_vsyscall () #5 0xb73b5f86 in poll () from /lib/i386-linux-gnu/i686/cmov/libc.so.6 #6 0xb7890f5b in g_poll () from /lib/libglib-2.0.so.0 #7 0xb788096f in ?? () from /lib/libglib-2.0.so.0 #8 0xb78810f3 in g_main_loop_run () from /lib/libglib-2.0.so.0 #9 0xb64396f4 in ?? () from /usr/lib/gio/modules/libdconfsettings.so #10 0xb78a9b6f in ?? () from /lib/libglib-2.0.so.0 #11 0xb77dec39 in start_thread () from /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 #12 0xb73c396e in clone () from /lib/i386-linux-gnu/i686/cmov/libc.so.6 Where the "handling_signal == 0" check is one I added to input_available_signal right after the SIGNAL_THREAD_CHECK. This is with a Lucid build: pthreads gets involved because of libdconfsettings, apparently. IOW we should also set FORWARD_SIGNAL_TO_MAIN_THREAD when using libdconfsettings (and maybe some more). Tho a better fix might be to better set up our signal handlers so we don't need this SIGNAL_THREAD_CHECK hack which seems unreliable (it drops signals on the floor when delivered to the wrong thread, which would seem to mean the main thread may fail to be told about pending input to be processed). Stefan In GNU Emacs 24.0.50.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2011-08-01 on ceviche Windowing system distributor `The X.Org Foundation', version 11.0.11002000 configured using `configure 'CFLAGS=-Wall -Wno-pointer-sign -DUSE_LISP_UNION_TYPE -DSYNC_INPUT -DENABLE_CHECKING -DXASSERTS -DFONTSET_DEBUG -g -O1 -I/usr/include/GNUstep' '--enable-maintainer-mode' '--with-x-toolkit=lucid'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: fr_CH.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: InactiveMinibuffer Minor modes in effect: electric-pair-mode: t electric-indent-mode: t url-handler-mode: t global-reveal-mode: t reveal-mode: t auto-insert-mode: t savehist-mode: t minibuffer-electric-default-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-x 5 0 M-x r e - e m - b u Recent messages: Loading ~/src/elisp/bbdb/lisp/bbdb-autoloads...done Loading /home/monnier/src/elisp/ProofGeneral/generic/proof-site.el (source)...done Warning: set-coding-priority is obsolete! Warning: interactive-p is obsolete! Loading /home/monnier/src/elisp/sml-mode/sml-mode-startup.el (source)...done Loading /home/monnier/etc/emacs/X11.el (source)...done Loading /home/monnier/etc/emacs/custom.el (source)...done Ispell-kill: nil american Starting new Ispell process [american] ... For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort mail-extr message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader emacsbug server noutline outline easy-mmode flyspell ispell eldoc checkdoc regexp-opt thingatpt help-mode view prog-mode load-dir electric url-handlers url-parse auth-source warnings eieio byte-opt bytecomp byte-compile cconv macroexp assoc gnus-util password-cache url-vars mm-util mail-prsvr reveal autoinsert uniquify advice help-fns advice-preload time-date savehist minibuf-eldef disp-table cl cl-loaddefs all-autoloads company-autoloads debbugs-autoloads epoch-view-autoloads js2-mode-autoloads load-dir-autoloads markchars-autoloads minimap-autoloads muse-autoloads info easymenu rainbow-mode-autoloads register-list-autoloads sisu-mode-autoloads uni-confusables-autoloads windresize-autoloads package tabulated-list proof-site proof-autoloads pg-vars bbdb-autoloads agda2 tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page newcomment menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting x-toolkit x multi-tty emacs)