delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/06/16/14:56:01

DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 45GIu1t31787719
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=hICJYZE1
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7BAE3882062
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1718564159;
bh=OxCmkYJP2DgxxaT8hPsCtoE9bfu5GTz5HYsie3SfrVQ=;
h=Subject:Date:To:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=hICJYZE1QKdOiVGNdgRoCQrQwsMu+d1PYC9WDVT4KEd8LLSRjQmnNjEb5FgD2V1ny
sNTOdyC51NTqQ0D9Dtphl3EmFLwl3eYsCsSeulhJar5KHVgDvkvSNjWX039p4Z/CFd
K/EQyf8R0T9FXs2lsw6CSb55JYi/ao/8rXlEr5Ts=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 945043858429
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 945043858429
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
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)
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: <DC419F64-5E24-493F-AFB7-9B31062A3FB6@zaxiom.com>
Date: Sun, 16 Jun 2024 13:54:47 -0500
To: cygwin AT cygwin DOT 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
X-Content-Filtered-By: Mailman/MimeDel 2.1.30
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Nicholas Williams via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Nicholas Williams <nicholas DOT williams AT zaxiom DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 45GIu1t31787719

Hello,

We have a Python (installed and run through Cygwin) process running on Windows Server 2022 that was very, very occasionally failing when subprocess.check_output was called:

0 [main] python3 28481 dofork: child -1 - forked process 16856 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
…
    subprocess.check_output(["cygpath", "-w", directory.name], encoding="utf-8").strip()
File "/usr/lib/python3.9/subprocess.py", line 424, in check_output <>
     <>return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, <>
File "/usr/lib/python3.9/subprocess.py", line 505, in run <>
     <>with Popen(*popenargs, **kwargs) as process: <>
File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ <>
     <>self._execute_child(args, executable, preexec_fn, close_fds, <>
File "/usr/lib/python3.9/subprocess.py", line 1754, in _execute_child
    self.pid = _posixsubprocess.fork_exec(
BlockingIOError: [Errno 11] Resource temporarily unavailable

Setting aside for a minute the various reasons this might be happening occasionally, which we cannot solve for at this moment, the error number (EAGAIN) indicates that you should “try again.” So that’s 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 to 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’t forget about the problem, but the warning only ever appears once, so retrying a single time seems to help.

However … even though Python handles the dofork error, turns it into a Python exception, and our code catches the Python exception and handles it properly, Cygwin (not Python … 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 unexpectedly, 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’re running]

I’m sure there could be any number of things I might be missing, but IMO, if the process calling dofork properly handles the error raised by dofork, Cygwin should not be outputting an error message to stderr.

Thoughts?

Thanks,

Nick

 <>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019