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: Sat, 13 Jul 2019 18:17:41 +0000 Message-ID: References: <87muhks3b5.fsf@hochschule-trier.de> <83muhj2zmb.fsf@gnu.org> <83ims72xcj.fsf@gnu.org> <83a7dj2sz9.fsf@gnu.org> <835zo72jmr.fsf@gnu.org> <834l3r2jbe.fsf@gnu.org> <8336jb2fhq.fsf@gnu.org> <83wogmyo1k.fsf@gnu.org> <83sgraylof.fsf@gnu.org> <83r26tzzvm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000147891058d940dfa" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="193519"; 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 Sat Jul 13 20:19:08 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 1hmMc0-000oAt-7M for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Jul 2019 20:19:08 +0200 Original-Received: from localhost ([::1]:57630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmMbz-0001G5-9z for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Jul 2019 14:19:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52739) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hmMbv-0001Ek-Dp for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2019 14:19:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hmMbu-0001dD-3j for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2019 14:19:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34547) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hmMbt-0001d0-WA for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2019 14:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hmMbt-0006nU-PK for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2019 14:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Jul 2019 18:19:01 +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.156304190926086 (code B ref 36609); Sat, 13 Jul 2019 18:19:01 +0000 Original-Received: (at 36609) by debbugs.gnu.org; 13 Jul 2019 18:18:29 +0000 Original-Received: from localhost ([127.0.0.1]:43368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hmMbM-0006mf-Vt for submit@debbugs.gnu.org; Sat, 13 Jul 2019 14:18:29 -0400 Original-Received: from mail-oi1-f177.google.com ([209.85.167.177]:41749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hmMbH-0006mL-B6 for 36609@debbugs.gnu.org; Sat, 13 Jul 2019 14:18:23 -0400 Original-Received: by mail-oi1-f177.google.com with SMTP id g7so9725565oia.8 for <36609@debbugs.gnu.org>; Sat, 13 Jul 2019 11:18:23 -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=mzZkaJHW5nmlIWExZb8uKEaZ798kWzs9JJmSzRAb3CA=; b=XotH7si4/rukADUozTeYizxEwg0IJWVBUJtkB5BH7+AiMbICtsVWKuo3NXht5GzESK +pRh3g024mX58Xa0rML5tqc6kjcqCmH07bTiJa1xAi9xLyoY+bqiJQhqstfJqvqHgiPa y2TkyUZRQxjc9KkKF7extT/tudh06akbdsP3TTnC30jCUOe0rYaTRb7o/j1iF/BTaSQd LUNi+N4aXU6niCp/72JcMkB9SHnrqSRRhobUsNVtrefnK70iIPdBHufdk4vM9kP5EUCX ArAlevXWUzWRF6kNMDjY/3T+bycnGEZ+2zSjxzjZ8EI7+zU+/ubm0RGfnWbqoVv7DIv6 jfng== 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=mzZkaJHW5nmlIWExZb8uKEaZ798kWzs9JJmSzRAb3CA=; b=Uih8gCaqOYuKuGlYEe03f1kwVHTjurA3fGwK9mjAcH27eMH9UN0G3qY8dBrH5mLh+Q wzALRRpezTk5uZ0j1ktchEy7Kxwodsx0c48sYaP1enmgaLddnzgAcTD+vzzgGx5cfHmv SiTbkWPDhtilpzv3Qw6yzI7UrazQ7iUiwi+ERQ6CjMkOOrXAB/Ap3MSlIdSGyeZE57r3 EAEZ4Jasm0B3EpZqpPq/rkr4Qfkhuq/eBEYjPiceuOg6gV+0Adtm6Qy1RjErLu3I2QA7 o7lzkKhbb44qransHmIQ23GU/ACwqe/KqenP69lhF9Lakhml+j6VcOkpqfo7nFvJxY9z t6xw== X-Gm-Message-State: APjAAAWwdK/dISn0BuJ1SSVP2k/gYcEkdfOfF4psRaUNcetvIuX2qeSn J8M32FHSgkpcKISgpGkIEPHcmlicemBmoESBphQ= X-Google-Smtp-Source: APXvYqxNcbYc4E5h+fZJvy5tsNR1OHiUVj+lskARB2mIQ5rXi55Duk5vMxEPEKn0icOt9l/rnk3WV1SypecJ/Xo51eg= X-Received: by 2002:aca:aa93:: with SMTP id t141mr9177172oie.128.1563041897631; Sat, 13 Jul 2019 11:18:17 -0700 (PDT) In-Reply-To: <83r26tzzvm.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:162932 Archived-At: --000000000000147891058d940dfa Content-Type: text/plain; charset="UTF-8" Patch attached. It's possible this'll livelock certain glib libraries that want to modify the glib main context while another thread is running. I don't see a good way to fix that, but a bad way would be to apply some heuristic (such as a 10 ms delay between calling select() and assuming it actually was called). --000000000000147891058d940dfa Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Fix-lock-failures-in-xg_select-bug-36609.patch" Content-Disposition: attachment; filename="0001-Fix-lock-failures-in-xg_select-bug-36609.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jy1uq3dr0 RnJvbSBkOTkyMjJiMWNmNWI2M2U4MzYxZTlhN2NkYmUxM2ZhYWZiNDBjMWQ1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaXAgQ2V0IDxwaXBjZXRAZ21haWwuY29tPgpEYXRlOiBTYXQs IDEzIEp1bCAyMDE5IDE4OjA5OjM4ICswMDAwClN1YmplY3Q6IFtQQVRDSF0gRml4IGxvY2sgZmFp bHVyZXMgaW4geGdfc2VsZWN0IChidWcjMzY2MDkpCgoqIHNyYy94Z3NlbGVjdC5jIChyZWxlYXNl X3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