From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#36609: 27.0.50; Possible race-condition in threading implementation Date: Fri, 12 Jul 2019 13:51:48 +0000 Message-ID: References: <87muhks3b5.fsf@hochschule-trier.de> <83muhj2zmb.fsf@gnu.org> <83ims72xcj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="105169"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 36609@debbugs.gnu.org, politza@hochschule-trier.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 12 15:55:57 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hlw1l-000RBU-3E for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jul 2019 15:55:57 +0200 Original-Received: from localhost ([::1]:49670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvzS-0005KF-Ce for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jul 2019 09:53:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32900) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlvyx-0003RV-R1 for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 09:53:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlvyw-0001Xv-Mj for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 09:53:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hlvyw-0001Xk-HZ for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 09:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hlvyw-0006gM-Eu for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2019 09:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jul 2019 13:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36609 X-GNU-PR-Package: emacs Original-Received: via spool by 36609-submit@debbugs.gnu.org id=B36609.156293955525652 (code B ref 36609); Fri, 12 Jul 2019 13:53:02 +0000 Original-Received: (at 36609) by debbugs.gnu.org; 12 Jul 2019 13:52:35 +0000 Original-Received: from localhost ([127.0.0.1]:39405 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlvyT-0006fe-Mb for submit@debbugs.gnu.org; Fri, 12 Jul 2019 09:52:35 -0400 Original-Received: from mail-oi1-f196.google.com ([209.85.167.196]:38957) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlvyS-0006fQ-57 for 36609@debbugs.gnu.org; Fri, 12 Jul 2019 09:52:32 -0400 Original-Received: by mail-oi1-f196.google.com with SMTP id m202so7328631oig.6 for <36609@debbugs.gnu.org>; Fri, 12 Jul 2019 06:52:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+280ro4FM7jUHwvU0erIjWzKO9MvMNZqoANXyWNHPXk=; b=HZMoOSBCHBFKu3feliCfIkvO++VQYl8jdYWOBtLf0+160YZoC8LdvF/FyWTmXsvMd9 txHdOBoguJZ3X8Qa0jr3PYDh/3JWz/MKDS/WxAKitOmfkoSj93mF/bjkbHwMecjTaJGG /ZvDI3D40U5TX8soNBmo5P5vy8niN1VXpQroVP9pFYcOAGWwfK1XAYuPh7oHVtZOwT3U 4XY6WtKKiUEPIJgyyrAMY6QyQoNp8O9Lcn2RuLI5eNXK35eh2qVyPXdhVr19P2KFCCP7 BgZd/53UVjbXuHbXaHrmCr5yHaAfjVsqTk+scxMNbzs+EDdBoXP7UGoj9IxC86nSctTP fDuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+280ro4FM7jUHwvU0erIjWzKO9MvMNZqoANXyWNHPXk=; b=qABLtIQnJpnyaHSlWx5lxhjZJsNQd8duCDFkrmK2OwkOMe53tiVPAcIo5fN59c3+MR xPQaZm0/g4yPpsqWr03p1Oalo8n1ZjEeiqzUTVnnGFaE7MCOkNEfCYVpf5rsuJL7/B5z 3DIn4e2hXvPc6EW1fSKQ8CgOU0TmmUxbWv4xddz7n/QpvBlzM/DVNtlTVhDNXsPvzaj+ ltOzBITePafdgvBXPDKl7D5EdFHBZsa0UFPU61jRo5jqbrqfG1Hx5jAjT6TuJgYfrIki agkKsxc+FnFeiHjrBtXY/6uHqZX1Io+MWb8Cz5ljFtYiLCVq8n+iXQVB5kOXoNEbI81n L4hQ== X-Gm-Message-State: APjAAAXaiD1NSWrEq1EPk6TCgFKhIA45p7waX3C9WJNA+Tv/kWKRfC2+ yvN3flOJZ3chYtjhtDo7qNi/0KHuSfszxZ4gdg8= X-Google-Smtp-Source: APXvYqzNFo401ElS2IwIAxrf5Col7vm3Y5X3DbHaTl3yqRv12njrxKXJ+YtIVPVcegggxGBvlc+6UdRntg4v9laKTVQ= X-Received: by 2002:aca:4790:: with SMTP id u138mr6269678oia.44.1562939545202; Fri, 12 Jul 2019 06:52:25 -0700 (PDT) In-Reply-To: <83ims72xcj.fsf@gnu.org> 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: 209.51.188.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:162765 Archived-At: On Fri, Jul 12, 2019 at 1:31 PM Eli Zaretskii wrote:> > > From: Pip Cet > > Date: Fri, 12 Jul 2019 12:57:51 +0000 > > Cc: politza@hochschule-trier.de, 36609@debbugs.gnu.org > > > > Lisp Backtrace: > > "sleep-for" (0xedf7a530) > > 0xf6da40 Lisp type 3 > > > > post_acquire_global_lock () can return abnormally (I didn't know > > that), so really_call_select() can, too, so thread_select() can, too. > > Do you know which code sets current_thread->error_symbol, and what is > that error symbol? thread-signal, which my example code calls directly. I passed 'error, and that's what error_symbol is set to. last_thread_error is (error) when the Emacs session freezes. > > > > + ptrdiff_t count = SPECPDL_INDEX (); > > > > > > I don't think we should do that at this low level. > > > > You're right, it does stick out. I think we're safe because we're > > calling Fsignal with the global lock held, but it's not a pretty or > > well-documented situation. > > Is this the main thread which does that? if so, there should be no > problem with holding the global lock in this case, is there? > > If this is not the main thread, then the error handlers should be set > so as to log the error in last_thread_error, and then terminate the > thread (via exiting the thread function, AFAIR). Indeed, that's what happens; but the thread now fails to release the GLib lock it had previously acquired, so other threads cannot acquire it again, ever. > If this is not what happens, I'd like to know what does happen here, > and why. Sure, we should understand what's going on here; even if the fix turns out to be simple.