From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gemini Lasswell Newsgroups: gmane.emacs.bugs Subject: bug#32487: 26.1.50; keyboard-quit while main thread blocked crashes Emacs Date: Mon, 20 Aug 2018 15:57:08 -0700 Message-ID: <876004r6ij.fsf@runbox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1534805895 21238 195.159.176.226 (20 Aug 2018 22:58:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 20 Aug 2018 22:58:15 +0000 (UTC) To: 32487@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 21 00:58:11 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frt7j-0005O4-1y for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Aug 2018 00:58:11 +0200 Original-Received: from localhost ([::1]:49624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frt9p-0007F6-IR for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Aug 2018 19:00:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frt9c-0007Ci-Kp for bug-gnu-emacs@gnu.org; Mon, 20 Aug 2018 19:00:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frt9X-000058-Av for bug-gnu-emacs@gnu.org; Mon, 20 Aug 2018 19:00:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50976) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frt9W-0008Rh-7M for bug-gnu-emacs@gnu.org; Mon, 20 Aug 2018 19:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1frt9W-0006JF-1a for bug-gnu-emacs@gnu.org; Mon, 20 Aug 2018 19:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Aug 2018 23:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32487 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.153480594324153 (code B ref -1); Mon, 20 Aug 2018 23:00:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Aug 2018 22:59:03 +0000 Original-Received: from localhost ([127.0.0.1]:55993 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frt8Y-0006HL-DI for submit@debbugs.gnu.org; Mon, 20 Aug 2018 18:59:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1frt8W-0006H0-4M for submit@debbugs.gnu.org; Mon, 20 Aug 2018 18:59:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frt8P-0007S3-SS for submit@debbugs.gnu.org; Mon, 20 Aug 2018 18:58:54 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58613) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1frt8P-0007Rt-Oo for submit@debbugs.gnu.org; Mon, 20 Aug 2018 18:58:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frt8L-0006Ox-Ld for bug-gnu-emacs@gnu.org; Mon, 20 Aug 2018 18:58:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frt77-0006vz-JA for bug-gnu-emacs@gnu.org; Mon, 20 Aug 2018 18:57:37 -0400 Original-Received: from aibo.runbox.com ([91.220.196.211]:54070) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frt77-0006vA-7l for bug-gnu-emacs@gnu.org; Mon, 20 Aug 2018 18:57:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=f7FkVOffpLjHT6wxjtBjX15QLHNrBpsqzUsWzY1hsIM=; b=Ia+uRcMyZJvSBDCXcHB/4iUIq UpI6VPYMfaSUOg3LnEGq7M8NddpTqpGHkvAVCOfT8W/RrCe9nh8CnT6vs0oCQjERe1HPgAafIsv03 DKZOF/bkkVVW6wWjD4ev0HKvG9uKgAh9N8qFLZh/moLcD2jkaqNpyxy9UJ77CXzP80ronCZ70CuUF JIT8SdcGXphJTRvqUA0ZHR48KFNRzAECArzAO8YK1xB139MS96uHJcwGZ9vIwzQxVct9iyeHnVtc3 KQSI59hBekOnh013AnpktLVjvPd3Mdxlqf35Yx+HWlA6a768BXq9IarE5PqNjQP4yvcJXoV2qQUGM YnIp3RTUQ==; Original-Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1frt75-0007M7-Kx for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 00:57:31 +0200 Original-Received: by mailfront10.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1frt6k-0004f1-8U for bug-gnu-emacs@gnu.org; Tue, 21 Aug 2018 00:57:11 +0200 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:149627 Archived-At: In both emacs-26 and master, it's possible to hang or crash Emacs with Lisp code which uses threads and is buggy in ways which cause the main thread to be blocked, combined with keyboard-quit. To reproduce, copy the code listed below into a buffer and evaluate it (with emacs -Q if you wish). Then choose one of: M-x my-hang-1 RET M-x my-hang-2 RET M-x my-hang-3 RET Result: Emacs will stop responding to keyboard input. Repeated use of C-g will do nothing when running under X11 and will cause Emacs to crash when running in a terminal. (defvar my-mutex-1 (make-mutex "mutex-1")) (defun my-wait-on-locked-mutex () (with-mutex my-mutex-1 (message "mutex-1 wasn't locked"))) (defun my-hang-1 () (interactive) (with-mutex my-mutex-1 (let ((thread (make-thread #'my-wait-on-locked-mutex))) (thread-join thread)))) (defvar my-mutex-2 (make-mutex "mutex-2")) (defvar my-var-2 nil) (defun my-inf-loop () (mutex-lock my-mutex-2) (while t (setq my-var-2 t) (thread-yield))) (defun my-hang-2 () (interactive) (setq my-var-2 nil) (let ((thread (make-thread #'my-inf-loop))) (while (not my-var-2) (thread-yield)) (with-mutex my-mutex-2 (message "mutex-2 wasn't locked")))) (defvar my-cond-mutex (make-mutex "cond-mutex")) (defvar my-cond-var (make-condition-variable my-cond-mutex)) (defvar my-var-3 nil) (defun my-fail-to-notify () (with-mutex my-cond-mutex (setq my-var-3 t))) (defun my-hang-3 () (interactive) (setq my-var-3 nil) (let ((thread (make-thread #'my-fail-to-notify))) (with-mutex my-cond-mutex (while (not my-var-3) (condition-wait my-cond-var))))) In GNU Emacs 26.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.28) of 2018-08-05 built on localhost Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --prefix=/nix/store/4pwyx7ixl5fbdj75kmbsnzcrbsvkvg09-emacs-26.1.50 --with-modules --with-x-toolkit=gtk3 --with-xft' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS LCMS2 Important settings: value of $EMACSLOADPATH: /nix/store/7xj2afwwci2r69g5ghhf7qlinlpxw858-emacs-packages-deps/share/emacs/site-lisp: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /nix/store/7xj2afwwci2r69g5ghhf7qlinlpxw858-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-2.11.0/magit-popup hides /nix/store/7xj2afwwci2r69g5ghhf7qlinlpxw858-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-popup-2.12.2/magit-popup /nix/store/7xj2afwwci2r69g5ghhf7qlinlpxw858-emacs-packages-deps/share/emacs/site-lisp/elpa/soap-client-3.1.3/soap-inspect hides /nix/store/4pwyx7ixl5fbdj75kmbsnzcrbsvkvg09-emacs-26.1.50/share/emacs/26.1.50/lisp/net/soap-inspect /nix/store/7xj2afwwci2r69g5ghhf7qlinlpxw858-emacs-packages-deps/share/emacs/site-lisp/elpa/soap-client-3.1.3/soap-client hides /nix/store/4pwyx7ixl5fbdj75kmbsnzcrbsvkvg09-emacs-26.1.50/share/emacs/26.1.50/lisp/net/soap-client /nix/store/7xj2afwwci2r69g5ghhf7qlinlpxw858-emacs-packages-deps/share/emacs/site-lisp/elpa/seq-2.20/seq hides /nix/store/4pwyx7ixl5fbdj75kmbsnzcrbsvkvg09-emacs-26.1.50/share/emacs/26.1.50/lisp/emacs-lisp/seq /nix/store/7xj2afwwci2r69g5ghhf7qlinlpxw858-emacs-packages-deps/share/emacs/site-lisp/elpa/let-alist-1.0.5/let-alist hides /nix/store/4pwyx7ixl5fbdj75kmbsnzcrbsvkvg09-emacs-26.1.50/share/emacs/26.1.50/lisp/emacs-lisp/let-alist Features: (shadow sort mail-extr emacsbug message rmc puny seq seq-25 byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 95020 4549) (symbols 48 20383 1) (miscs 40 44 118) (strings 32 28447 1654) (string-bytes 1 773489) (vectors 16 14062) (vector-slots 8 502938 6272) (floats 8 49 68) (intervals 56 216 0) (buffers 992 11))