GNU bug report logs - #81951
32.0.50; Race conditions in nnimap?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs,gnus; Reported by: Nickolai Dobrynin <ndobrynin@HIDDEN>; dated Tue, 29 Sep 2026 12:23:08 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 81951 <at> debbugs.gnu.org:


Received: (at 81951) by debbugs.gnu.org; 29 Sep 2026 23:32:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 29 19:32:44 2026
Received: from localhost ([127.0.0.1]:40335 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1xBhJQ-0002KA-Hn
	for submit <at> debbugs.gnu.org; Tue, 29 Sep 2026 19:32:43 -0400
Received: from mail-wr2-x10.google.com ([2a00:1450:4864:30::10]:59612)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <ndobrynin@HIDDEN>)
 id 1xBhJF-0002Dt-W4
 for 81951 <at> debbugs.gnu.org; Tue, 29 Sep 2026 19:32:33 -0400
Received: by mail-wr2-x10.google.com with SMTP id
 ffacd0b85a97d-4834977ae75so2850074f8f.3
 for <81951 <at> debbugs.gnu.org>; Tue, 29 Sep 2026 16:32:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1790724743; x=1791329543; darn=debbugs.gnu.org;
 h=content-type:mime-version:message-id:date:content-language
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to:content-type;
 bh=K4IKmaHPj7o8kuG6IdbbQzr/6NTn/sCL11MmBqfWlow=;
 b=LW27OAvfxphB8VEQyGH43Zf/4SGFjBUAP8hnkJA3oKH0cJt9ZvKjFC2ISmo8bN5H2R
 4mMn7GTBmmG6C64XY4ln6tu2M3hN6jC7VT15E5PHcQGn7od+LpMcC1EYHy2SN3Tzt5MB
 s3VbRUmQPQZ+/ZIzehAsNjzrYnNETEwzBQTR7/ywNXoLxPtnH0QouNgJeMCOKMXZ+Urm
 nUyZuJzT+42j05pMEvRMTQSLkCWC+NuQzgIiIBdAbO1TQuuW5OM+DOQIZCRy9HpoEpYw
 qDfZ+ndSqzx6miIriXUgvbyLgN1PnX6skTjL9Ihjwc2XTisuM5HyrJnZnUeztkowPCWu
 KcGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20260707; t=1790724743; x=1791329543;
 h=content-type:mime-version:message-id:date:content-language
 :references:in-reply-to:subject:cc:to:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
 :content-type;
 bh=K4IKmaHPj7o8kuG6IdbbQzr/6NTn/sCL11MmBqfWlow=;
 b=HvCTU6W9kG1ENEnXAi84JLHXk5bUEjz8rI2DEckeTYjaPzxjz3DjXzIdn6CLWnGWOy
 7z7tKZR2kaAptnstM8l4X0wc+Uf32Olao67/oeyG5kBev7PhnGN3Hy0jBQ3J/WSq8Xyt
 3qA7mHNqLiWfl30aFSEnRrhnPcjLlJlycH61feYJuFhvkZXFi0Mtrxh5zNA/5QoWlaUp
 4JVbStltFou3Ma4oVY8SHf/ihAg3umnIz+eG5cPVSogPp2e4eeTqWIRV9dELxTPl0NOM
 NC5KXA/r4GmzkOu6RSreNtdho7CRdgm+8FN4T0PHv8fkCHaEUWJ3hW9dAtv/WP7k7Ba4
 tAGg==
X-Gm-Message-State: AFq9FYIvSda+M5JH3ptvRGta11mPD4o1SPdX3foDDiNyqi3rQa+7lD/u
 6Ss/ZdbAsGVjJS3V1lygDjoIo+CDEqk6bcveEKXoS5KS4L1Qygqrj1IvFBVwyQ==
X-Gm-Gg: AYBFou3t+bjFxWLXjfLu4BrNNUj1a6JU42tBhj22hd3mCkn+UJfPhDnKhJB7N2xZ3Ns
 Abk3yN4wEE3esh0JqUMHTZIxFP4c3L9BoGljybHlKC1a1LpTsS8si4wFjuM/7JWoDeTm48TPT36
 CYndYOvS1XJqPssoIBEVu1+ABRbMtzTX5EndzYhqrxF8d9ZfC4k9WaIYURdcnZLPI++b2L8W+qc
 M6Z1Us9zBpGiKhU+BJwm7eOV5bjhC7VpWWuNlWfMJXIzHHmNrMU1MQIhSDjDrekSN90xoJEGr72
 J9iNiOI37Gi+auhnmI6PlESk8c0md3/O7KPmMbznhmMwlsQ5W/Wv1rGUXkbzcI7o5gDtl2gQF4N
 5mR+3FC+q6FW+1QLLeZFgjNPS4UCSB309SXJiwGGgEiUHbOvNp+XIbZh35I2CqqTBU5s5BPJTFU
 Sf1Omi1JNMkDkli4ggncKw/CbzrVzv6shWnMpkxHEJb/KKvmfBuxwSjqX55nT4roIfrUgs78BOG
 Sax011WJ9FQ8a9e5e8/qg3z1y0CR6vfS5zNze4yqqX6K19TjsISTaPKYn0PuUty9KKkeTQTwyNq
 mALlfMmFjLLt
X-Received: by 2002:a05:6000:46c8:b0:487:40a:5ba8 with SMTP id
 ffacd0b85a97d-48afe79206fmr973232f8f.15.1790724743096; 
 Tue, 29 Sep 2026 16:32:23 -0700 (PDT)
Received: from nova-laptop.dobrynin.net
 (p200300eaef00f930e4c74338c26ed393.dip0.t-ipconnect.de.
 [2003:ea:ef00:f930:e4c7:4338:c26e:d393])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-48afe69d799sm2312330f8f.23.2026.09.29.16.32.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 29 Sep 2026 16:32:22 -0700 (PDT)
From: Nickolai Dobrynin <ndobrynin@HIDDEN>
To: Robert Pluim <rpluim@HIDDEN>
Subject: Re: bug#81951: 32.0.50; Race conditions in nnimap?
In-Reply-To: <87a4p0i183.fsf@HIDDEN>
References: <874if8fds8.fsf@HIDDEN> <87a4p0i183.fsf@HIDDEN>
Content-Language: en-US
Date: Wed, 30 Sep 2026 01:32:20 +0200
Message-ID: <87y0cjd46z.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 81951
Cc: 81951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Robert Pluim <rpluim@HIDDEN> writes:

>>>>>> On Tue, 29 Sep 2026 14:22:15 +0200, Nickolai Dobrynin <ndobrynin@HIDDEN> said:
>
>
>     Nickolai> Leaving the manual aside, the pattern
>
>     Nickolai>   (while (process-live-p process)
>     Nickolai>     (accept-process-output process))
>
>     Nickolai> *itself* violates basic principles of asynchronous programming.
>
>     Nickolai> You will find another problematic instance in nnimap if you search for
>
>     Nickolai> ;; Check that the process is still alive.
>
>     Nickolai> and another one in `nnimap-wait-for-response'.
>
>     Nickolai> Please let me know if you see any flaws in these arguments. Is there
>     Nickolai> something obvious I am missing?
>
>     Nickolai> I don't have enough time right now to create a patch, but conceptually,
>     Nickolai> it would look exactly like the manual suggests:
>
>     Nickolai>   (while (accept-process-output process)
>     Nickolai>    (handle-incoming-data))
>
>     Nickolai> I will try to get to this ASAP, but if someone could fix this sooner,
>     Nickolai> all the better.
>
> I think you're right.

Thank you.

> But I don't have time to fix it either

Putting it on my TODO list.




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#81951; Package emacs,gnus. Full text available.

Message received at 81951 <at> debbugs.gnu.org:


Received: (at 81951) by debbugs.gnu.org; 29 Sep 2026 14:25:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 29 10:25:37 2026
Received: from localhost ([127.0.0.1]:55989 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1xBYlx-0000Qr-IA
	for submit <at> debbugs.gnu.org; Tue, 29 Sep 2026 10:25:36 -0400
Received: from mail-ed2-x0d.google.com ([2a00:1450:4864:33::d]:39446)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <rpluim@HIDDEN>) id 1xBYlp-0000Ol-S7
 for 81951 <at> debbugs.gnu.org; Tue, 29 Sep 2026 10:25:29 -0400
Received: by mail-ed2-x0d.google.com with SMTP id
 4fb4d7f45d1cf-6abc27842b6so4577593a12.3
 for <81951 <at> debbugs.gnu.org>; Tue, 29 Sep 2026 07:25:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1790691919; x=1791296719; darn=debbugs.gnu.org;
 h=content-transfer-encoding:content-type:mime-version:message-id:date
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to:content-type;
 bh=gvST8kMf8W/gs2Q/dj6LxZeuGB4I8a6zxk2VPZqmQkU=;
 b=IMDJUagjThFghXvogctmoF8dGRb3pbCEu4N5Cjv7oagXReRiPMvQ0EsJovRGp2R/u3
 Mf7t7G8T/7yXMSNzn2rMI2EH12di8+fj6xXZOmMdJZTiZ6YxGMYe7X93DTe0+UQCLHeK
 xhRiQdeEa0JXgykvpRqELYYcsnIbA3WfVHv869pRnkvFB9yus3atvRAZJjHia2PT7dbK
 08vG61kh8LetqB4s9QHK8NDrcsqAQx2FnaSWEZ6GYI3416OtLcrCsz0AGp9A+Z3VtNky
 r90B2ENDDmn0QUzKQrZwwiFMBqHJYDueR6l/gPGZ5oBeZAzCekBjdWTQssOJGnMT0loY
 rYUw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20260707; t=1790691919; x=1791296719;
 h=content-transfer-encoding:content-type:mime-version:message-id:date
 :references:in-reply-to:subject:cc:to:from:x-gm-gg
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
 :content-type;
 bh=gvST8kMf8W/gs2Q/dj6LxZeuGB4I8a6zxk2VPZqmQkU=;
 b=qXwAJLgVpp880x6SOsP+buAijMmbWfYCD+Fh+a/yqvFFvn4PcPbyZpWpiOptOjg7IO
 91211Gtk1lTUPBgEmcTPWT5IisAT2iDOeNp4i/+DptRde+3DfbyRpCdkLVxvUy1uOtim
 Skjvwt1iajrp6bdVp5gNYfSw7wgWq04c1JKrz7VtVU7sp9z2v4OVIbQ/FZR5gIkwpj29
 m5ESVIHSLQ6U7y4TCjgKwFxZqOg+nj4FbLb4GkpWcOKOEkS8AUsSc+Ru6zyJyclczDuP
 kdytTfz5AUeaMu+zqrqBOEnKsiSw0zfcAWebVmMvDKumgMzQwkL+nNGzW9wWV3VanPFt
 nFGw==
X-Gm-Message-State: AFq9FYJk8GOUAOVQyrNBiYFSMWzxeHF5WCNhjhcISmJD+k+C6UhZTIfC
 moU27Ioolbn00wCO0uZOrj/JYby8fRCJsrmZUbbmSZZMWUL/c0OmlTXP
X-Gm-Gg: AYBFou1P7R0wa9C1o2So6Kr/O74zFoKQYTN5NTK39O+R99ngxiGHhwU7tvPRYftb3mV
 9iccpf73SaBEZflrBXZ1nfxEM8E9uAD9b2Coki/hUwqU1MDoj4ApkBU+GtR/YBkWK71K1vOfdpE
 BloqOGlhRydwUd3OZckEkSH7TJP0vAIILCd35and0B/bHoKn4jrDoGPw933SGdWOBvmQ1fsNF4z
 fZQR+6eqB0tuJiIU6miwTLKEpbgeVuXLfJAO1XRmkT+WFAltr38kJkT4ebls1lzsm0/clDb9R1F
 ppsuf1AT1BMxtCNuxYmp8ipDkimQAH2gtlb4+EnklygRTZsnjFUTDpPYJHF9vQ2DQmUsr/0JfN2
 ABUG5Dk/jGWU2PRWh+JbcR7s3OKdl1GRDOIeDiSaahrp51WvP+C2lrvgegrHNt4AuTR00NBKYOl
 iw7ulvusNM/uQtg+oGaNlMh8MpyAUhqCJsp73dDq+g+PHVDhwmhWVCI/nEsoO/Cz7ohIGDrdF+5
 vzgFlFN7yDFOmDONnVQsZcQ1hgZAyhJM3yT93vn6kHl32htluSezuJr5Sow9BdPwX9KjFXVb5Ro
 5L1h3y5RCj/iZKifxibjrQ==
X-Received: by 2002:a05:6402:3044:b0:6ac:afa2:ca25 with SMTP id
 4fb4d7f45d1cf-6acafa2cf7emr1348106a12.6.1790691919225; 
 Tue, 29 Sep 2026 07:25:19 -0700 (PDT)
Received: from rlsb ([2a01:e0a:834:daf0:10a2:e1ff:fe2b:113a])
 by smtp.gmail.com with ESMTPSA id
 4fb4d7f45d1cf-6acc1e20f6esm248762a12.22.2026.09.29.07.25.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 29 Sep 2026 07:25:18 -0700 (PDT)
From: Robert Pluim <rpluim@HIDDEN>
To: Nickolai Dobrynin <ndobrynin@HIDDEN>
Subject: Re: bug#81951: 32.0.50; Race conditions in nnimap?
In-Reply-To: <874if8fds8.fsf@HIDDEN>
References: <874if8fds8.fsf@HIDDEN>
Date: Tue, 29 Sep 2026 16:25:16 +0200
Message-ID: <87a4p0i183.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 81951
Cc: Eli Zaretskii <eliz@HIDDEN>, 81951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

>>>>> On Tue, 29 Sep 2026 14:22:15 +0200, Nickolai Dobrynin <ndobrynin@gmai=
l.com> said:


    Nickolai> Leaving the manual aside, the pattern

    Nickolai>   (while (process-live-p process)
    Nickolai>     (accept-process-output process))

    Nickolai> *itself* violates basic principles of asynchronous programmin=
g.

    Nickolai> You will find another problematic instance in nnimap if you s=
earch for

    Nickolai> ;; Check that the process is still alive.

    Nickolai> and another one in `nnimap-wait-for-response'.

    Nickolai> Please let me know if you see any flaws in these arguments. I=
s there
    Nickolai> something obvious I am missing?

    Nickolai> I don't have enough time right now to create a patch, but con=
ceptually,
    Nickolai> it would look exactly like the manual suggests:

    Nickolai>   (while (accept-process-output process)
    Nickolai>    (handle-incoming-data))

    Nickolai> I will try to get to this ASAP, but if someone could fix this=
 sooner,
    Nickolai> all the better.

I think you=CA=BCre right. But I don=CA=BCt have time to fix it either (and=
 I
use external tools to do IMAP fetching these days).

(pop3 has the same issue, but, well, it=CA=BCs pop3.)

Robert
--=20




Information forwarded to bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#81951; Package emacs,gnus. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 29 Sep 2026 12:22:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 29 08:22:47 2026
Received: from localhost ([127.0.0.1]:59499 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1xBWr0-0007Sq-MW
	for submit <at> debbugs.gnu.org; Tue, 29 Sep 2026 08:22:43 -0400
Received: from lists1p.gnu.org ([2001:470:142::17]:46354)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ndobrynin@HIDDEN>)
 id 1xBWqs-0007RS-Vo
 for submit <at> debbugs.gnu.org; Tue, 29 Sep 2026 08:22:35 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ndobrynin@HIDDEN>)
 id 1xBWqj-0003yZ-NB
 for bug-gnu-emacs@HIDDEN; Tue, 29 Sep 2026 08:22:22 -0400
Received: from mail-wr2-x14.google.com ([2a00:1450:4864:30::14])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <ndobrynin@HIDDEN>)
 id 1xBWqi-0003fn-14
 for bug-gnu-emacs@HIDDEN; Tue, 29 Sep 2026 08:22:21 -0400
Received: by mail-wr2-x14.google.com with SMTP id
 ffacd0b85a97d-48af929e59dso221639f8f.3
 for <bug-gnu-emacs@HIDDEN>; Tue, 29 Sep 2026 05:22:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1790684538; x=1791289338; darn=gnu.org;
 h=content-type:mime-version:message-id:date:subject:cc:to:from:from
 :to:cc:subject:date:message-id:reply-to:content-type;
 bh=a6i6xabrjrPzO5fWm9lHzDRWGpaBWKmICAkEWrLY+ps=;
 b=qY7J2Fzr56/8VpqXJfpFAXsY4ycqACWzKdE6Fyfn9R+G8n9sRKLSolsYDw9xSrT5KU
 ruUKnX/7rZMHtB/TXuIt/FD4O3BfLWO6umT5MNCSetH2CgahXumdG8/bWzw7ioMxIb1p
 I1r3Pvstwnf1YW3l6B5FI0ASqbd4xsh6dFOVnVNFYTUDzrTI/D0bV2BbJj82snDAXfmk
 nElyhN/Tiyj1VPt+7Mp4loEQdj3F6v5N2uvAk/AWYk10wmszPU0WcK58c8HQ8jPaiu5o
 5P7N//Qxne1FNGRTxvGwOK2R5UqfUxsKyEN0NovLBeThN1K2sHtwKW0SP/7moVIjmjp/
 MIQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20260707; t=1790684538; x=1791289338;
 h=content-type:mime-version:message-id:date:subject:cc:to:from
 :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to:content-type;
 bh=a6i6xabrjrPzO5fWm9lHzDRWGpaBWKmICAkEWrLY+ps=;
 b=usX0/A1J3ExbDbwE6QYQDKMuRopwn2Hwgk+s3E0xYu3Ee2Im2w+9mC+7AO8Hdi2+6T
 PD056mrCuqMNp1kzGznzxOes/2Z15XpJBwGX2w3hw+/LhuNApoh/Lumc5RDQ5JmGjP0V
 SlFCE4Mf8fKCkHe5XVEPkMIxdoPSuphaW6sUlDZ6cxz3wSk17e9zuAxDZfuhHLceKnew
 7Ad64n8Zby8B3yPMINCTlQbmrV9jxdBMijM/NnbkvKsDSQ8aHAHjkRnzFQZIc20u5Qy3
 mKQiQfItBkaVYIIZQkG4i1TsotSRiUqj9xJotpJcnoJtK1cSKZKVOy5J4OaoqJrW3kik
 WlXQ==
X-Gm-Message-State: AFq9FYLYRuNQ4LoDYbiMpADn0eQbMaDJgaAs+ESynWImUOR7cTu509dc
 UPDhpUnNXXbqcPNpztmPzr5SZcQW/qkjsW8AhpcRfqni57gKc8/p+wgOM4ZTJw==
X-Gm-Gg: AYBFou0882DPs6+6ritIyRPmt6tly0xqgXhUge9X/K2IbJvkxA5gMHW3TW8kGPwGn8v
 6ZRD3Z77DzAU7qL9TPxsrMYxSIWUWcxYXGRCpM3gTH8xFuYzPxiIzRht55IcuPhVxAY4JprgCUY
 vqK0dujxQHO3oggg56mwRJTD/qRi6LlofSyz8VCnMLtEVG3eImk48vOlhCIbZ0SlOxrSmeyf0eC
 /E3Qhp6doEuxhe9QKpYGsKHBXnxfAsfAJe4YHdG5tK21sN8iOHSegWZY2PW4ssQHkD9EQJKiMM4
 ev53eRN9usphsERYTdVI1jgVUo746LvZwg1nAEG32uFinm+zasaqpLxpPr4K3qKRdcG1CpegJRM
 SKYJGkwkf4S7oF/wvgjjcL1B38COBpXuh46ESqIhC+8xP4qlJ9s+1pmR97ou7b0CPzo/t2gTQKz
 O27XqdVBPSjQELUctSRPnpWBiCMEe6byOD5paNNEO1rS/9Z+5l0HD1SkT53XhXe3mUdZlzo5mk0
 25it/EzW2DLSSmGksTVaXSbgGDh6eoDqbqLR4Bp4Qmg5dR43z/ClHvfIl8lPcUvQVKbv8evmGte
 Ow==
X-Received: by 2002:a05:6000:617:b0:488:654b:54d4 with SMTP id
 ffacd0b85a97d-488719776fdmr31242451f8f.50.1790684537773; 
 Tue, 29 Sep 2026 05:22:17 -0700 (PDT)
Received: from nova-laptop.dobrynin.net
 (p200300eaef00f930e4c74338c26ed393.dip0.t-ipconnect.de.
 [2003:ea:ef00:f930:e4c7:4338:c26e:d393])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-48af508cedfsm3634695f8f.30.2026.09.29.05.22.16
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 29 Sep 2026 05:22:17 -0700 (PDT)
From: Nickolai Dobrynin <ndobrynin@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 32.0.50; Race conditions in nnimap?
X-Debbugs-Package: emacs,gnus
X-Debbugs-Cc: eliz@HIDDEN
Date: Tue, 29 Sep 2026 14:22:15 +0200
Message-ID: <874if8fds8.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a00:1450:4864:30::14;
 envelope-from=ndobrynin@HIDDEN; helo=mail-wr2-x14.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: I've been running a very slow debugging version of Gnus for
 about two months now and having intermittent network-related failures ever
 since. These network failures rarely happen in release versions w [...] 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 1.0 FORGED_GMAIL_RCVD      'From' gmail.com does not match 'Received'
 headers -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (ndobrynin[at]gmail.com)
X-Debbugs-Envelope-To: submit
Cc: Eli Zaretskii <eliz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

I've been running a very slow debugging version of Gnus for about two
months now and having intermittent network-related failures ever
since. These network failures rarely happen in release versions where
debugging is turned off.

While I am still working on bug#81684, I've also been trying to nail
this other problem down.

Here is one instance I found:

(defun nnimap-wait-for-line (regexp &optional response-regexp)
...
  (while (and (memq (process-status process)
		      '(open run))
		(not (re-search-forward regexp nil t)))
        (nnimap-accept-process-output process)
        (goto-char (point-min)))

The sub-condition

(memq (process-status process) '(open run))

is equivalent to calling (process-live-p):

 -- Function: process-live-p process
     This function returns non-`nil' if PROCESS is alive.  A process is
     considered alive if its status is `run', `open', `listen',
     `connect' or `stop'.

  For a network, serial, or pipe connection, `process-status' returns
  one of the symbols `open', `stop', or `closed'.  The latter means

Another quote from the manual reads:

  Therefore, although the following loop:

       ;; This loop contains a bug.
       (while (process-live-p process)
         (accept-process-output process))

  will often read all output from PROCESS, it has a race condition and can
  miss some output if `process-live-p' returns `nil' while the connection
  still contains data.  Better is to write the loop like this:

       (while (accept-process-output process))

Leaving the manual aside, the pattern

  (while (process-live-p process)
    (accept-process-output process))

*itself* violates basic principles of asynchronous programming.

You will find another problematic instance in nnimap if you search for

;; Check that the process is still alive.

and another one in `nnimap-wait-for-response'.

Please let me know if you see any flaws in these arguments. Is there
something obvious I am missing?

I don't have enough time right now to create a patch, but conceptually,
it would look exactly like the manual suggests:

  (while (accept-process-output process)
   (handle-incoming-data))

I will try to get to this ASAP, but if someone could fix this sooner,
all the better.




Acknowledgement sent to Nickolai Dobrynin <ndobrynin@HIDDEN>:
New bug report received and forwarded. Copy sent to eliz@HIDDEN, bug-gnu-emacs@HIDDEN, bugs@HIDDEN. Full text available.
Report forwarded to eliz@HIDDEN, bug-gnu-emacs@HIDDEN, bugs@HIDDEN:
bug#81951; Package emacs,gnus. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 29 Sep 2026 23:30:09 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.