From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by sourceware.org (Postfix) with ESMTPS id 945043858429 for ; Sun, 16 Jun 2024 18:54:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 945043858429 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=zaxiom.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=zaxiom.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 945043858429 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b30 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718564102; cv=none; b=AkST+JS0K2SCk1H+eW+wUoqi/y719PnqM9e53sxXSHmz+WAgz9KiEGxnhNOKzS9j1wkFAiUegjXaj4P6xLGMA4a1yCc9HQi5Y74whlaujeDyKkYRnjjosiFS6QDnTNFxGm8EYJlp0rjdyee55iggMjRweiDR1xhJa3qBzDnw7Hc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718564102; c=relaxed/simple; bh=HQtcjyf4XmbhMyJ4WBQKxakXRrKkq8gW5WpUIuMVGgU=; h=DKIM-Signature:From:Mime-Version:Subject:Message-Id:Date:To; b=En/FtPhe5xECmhjr2x5VA0vBp01+90+mdD/5/XW7NvbsTYZKIe4bBp/ULZFyovyetTo6VoQG6OKDu7eoo0E7uIDJ8qgVnCLd/T7YCAg78mndQXn3jVXUH4zN2rtXIHrv5e5oTS49cQ1sDioz5D5msGcfXiCXC1AFRc1FXN43e54= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-dff0c685292so3164875276.3 for ; Sun, 16 Jun 2024 11:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zaxiom-com.20230601.gappssmtp.com; s=20230601; t=1718564098; x=1719168898; darn=cygwin.com; h=to:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=YF+zoD5wE5T257O9QdyvA2EIJbPpRRg9UF+wCWbwggA=; b=rH2jaAVv/WJ4NsI1N8iMGpaYo9Fp/vMhp0h6SUgovA1qoLeypylnJgGhiIqJapJaO7 kJtMyMnDfIPpEknWk0gZqT7LmbZ/DwPhkuY3/M7pXnnY0V9OxpQyL9EOJJaQKCLrU7td HcWDOXGDyLiAh2obYcu37XYxa96/k0RevOsxx465DvI0I5hUXfBvS6sM+jPLTQSIxMfv d1fpnJavTxGUQKal3V1tVWsr/qKeoE8fl1dnFgoMIZeoD/UtcaxKZUBQENcIBjdB42kG 2JCzbFIDJYj6KqMVADSMplDH/gVNvD/j9QBgmCPPsAgQ3/1c2uwysNxTB+sVp1rrxjpw Kb6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718564098; x=1719168898; h=to:date:message-id:subject:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=YF+zoD5wE5T257O9QdyvA2EIJbPpRRg9UF+wCWbwggA=; b=TfKkMPogP3L0o6GbyZnoWeLdTHuDfZo+a9Ft+L2TqcCaBTUUmTKOQNg0jmrZVwcpeZ +y1lT/z5Ff3tAzRP+3B4z4AsMY4BI9GwSVlliyHIdrCIkqHQXQ+i4WghQop4hXIw7tdq YaghE+t7e/0ZG1rA0ZrhgEzU9lSy5o5+MOIq0Bbw0MljJz0EPhTjbTK7muTIqDlJosfa eHHV5d9TmI/cm/MS5tBsHmlpoFQA+idkNwJLIpemJe3hmlFogudNUbefw4QPa3BbTo1c +iQ3d4iY16kmPr/7lbtatZEvh+PysW8Tpz8pTz6NiJxZFe6lPqhVltVf6wgGiQe2V5kT YjnA== X-Gm-Message-State: AOJu0YygkKX0G6iiCYx7bJJLkzE2CKcWeHRoVYQduhyVsA5HxZWDhIAx Y7JMJgH3mRA46Ry++1AfpVdo0ekCeKK//S5mafI0ngRPRAs3paXCzkfR3RoWSNK5cpvxXnWJ7dR D X-Google-Smtp-Source: AGHT+IHjQlJbWd+LHswJg92bOx+qgK99fQ4VXRAG5SShPxu7jW/eghLya0AKBWF8yHXWa5mwl/2lTg== X-Received: by 2002:a25:8751:0:b0:dff:305e:1cf6 with SMTP id 3f1490d57ef6-dff305e1db7mr3549903276.0.1718564098449; Sun, 16 Jun 2024 11:54:58 -0700 (PDT) Received: from smtpclient.apple ([96.74.41.169]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-dff04aa3bfasm1479075276.63.2024.06.16.11.54.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Jun 2024 11:54:58 -0700 (PDT) From: Nicholas Williams Content-Type: multipart/alternative; boundary="Apple-Mail=_DB408EC3-B114-47B1-8CDC-E97BBB567DF3" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\)) Subject: Cygwin outputting message to stderr on dofork EAGAIN failure even when Python exception is caught and handled Message-Id: Date: Sun, 16 Jun 2024 13:54:47 -0500 To: cygwin@cygwin.com X-Mailer: Apple Mail (2.3774.500.171.1.1) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --Apple-Mail=_DB408EC3-B114-47B1-8CDC-E97BBB567DF3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello, We have a Python (installed and run through Cygwin) process running on Wind= ows Server 2022 that was very, very occasionally failing when subprocess.ch= eck_output was called: 0 [main] python3 28481 dofork: child -1 - forked process 16856 died unexpec= tedly, retry 0, exit code 0xC0000142, errno 11 =E2=80=A6 subprocess.check_output(["cygpath", "-w", directory.name], encoding=3D"= utf-8").strip() File "/usr/lib/python3.9/subprocess.py", line 424, in check_output <> =C2=A0 =C2=A0=C2=A0 <>return run(*popenargs, stdout=3DPIPE, timeout=3Dtimeo= ut, check=3DTrue, <> File "/usr/lib/python3.9/subprocess.py", line 505, in run <> =C2=A0 =C2=A0=C2=A0 <>with Popen(*popenargs, **kwargs) as process: <> File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ <> =C2=A0 =C2=A0=C2=A0 <>self._execute_child(args, executable, preexec_fn, clo= se_fds, <> File "/usr/lib/python3.9/subprocess.py", line 1754, in _execute_child =C2=A0 =C2=A0 self.pid =3D _posixsubprocess.fork_exec( BlockingIOError: [Errno 11] Resource temporarily unavailable Setting aside for a minute the various reasons this might be happening occa= sionally, which we cannot solve for at this moment, the error number (EAGAI= N) indicates that you should =E2=80=9Ctry again.=E2=80=9D So that=E2=80=99s= exactly what we did. We added a try/catch to the Python code to catch the = BlockingIOError and, if and only if the error number is EAGAIN, we try up t= o two more times. This fixed the problem and caused the application to stop= quitting. We output a warning to our log so that we don=E2=80=99t forget a= bout the problem, but the warning only ever appears once, so retrying a sin= gle time seems to help. However =E2=80=A6 even though Python handles the dofork error, turns it int= o a Python exception, and our code catches the Python exception and handles= it properly, Cygwin (not Python =E2=80=A6 Cygwin) still outputs a message = to stderr right before our warning message. This Cygwin error message shows= up as an error in our log tracking: 0 [main] python3 15042 dofork: child -1 - forked process 6780 died unexpect= edly, retry 0, exit code 0xC0000142, errno 11 06/16 13:57:53. 87520: WARNING: Retrying command in 2 seconds due to EAGAIN= : [the command we=E2=80=99re running] I=E2=80=99m sure there could be any number of things I might be missing, bu= t IMO, if the process calling dofork properly handles the error raised by d= ofork, Cygwin should not be outputting an error message to stderr. Thoughts? Thanks, Nick <>= --Apple-Mail=_DB408EC3-B114-47B1-8CDC-E97BBB567DF3--