From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id EFA9D3882ACB for ; Tue, 18 Jun 2024 14:45:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EFA9D3882ACB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EFA9D3882ACB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718721912; cv=none; b=fzXjze2XqqsMijBRniX7TL5dpuD5MsqhhSfp5VaLmgIh93uF7Y9ximXt/coQGjKHwkqjIoAdFjkuHLFATx76Yu1lnts4W0/cBMTwLUsYoo2W3i4zhL9iTl3M2VBjksAWtCRBJ2OcrCvyDLtRSH2QF9a6BYOeHM/gnEWkI7GDJuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718721912; c=relaxed/simple; bh=VHtDSzXtn5jrkoBMtCleLWCoaSGcTsJUV/Xt5vrZ57w=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Zt9hEnpDsXu3aeJhreDXVfkgMQT16c/qscrlYUiDTCaGa6d/fr0XZwu9hg7LW9BOBSe7ZSVrcRC1uK8Kmp9znmPBWYbA5UJrzutJ90mPXQMT5BTUPx0hSFc1cHI8ydxvEY7soZS4sWHOwelbg9X6z2z+v+aw62gvicdp72Hm7aM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52bd48cf36bso6312366e87.3 for ; Tue, 18 Jun 2024 07:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718721908; x=1719326708; darn=cygwin.com; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Gb+kJcFgGAg760GqnYIsnk2k16YUg/IsRRPFwHSMFLU=; b=VxTgpbq7pAvXPeEXgSmNVLasynyyUaXpgVroMpTcp+ko8x8j8UC40+PNmG4D0lp/sX KMaHYhe8ldSmM3sd9sYfhMqC3ngG4LyccwvFEoOOS+/+OJW2MWoGEP2occcMxiBPbTfh 3J/Yn4S+I+JratHYtYsxzozOcDq8yZUSXxP/Zbl6KbzAw4ZbGlHam9W36ozeOLCJECIi JBRnlWmmZo26TfAoaVddYvbLeXpthitIQhWp01uH59xXPljOZZPo/w96BPYab8YPBRM/ avHPqmvI/oxmneTaskW4+kVZWO0WIB1B+mfzBJ2TFokj7sKvuEwuH7oRMiyHO3fvT0A/ LAmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718721908; x=1719326708; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gb+kJcFgGAg760GqnYIsnk2k16YUg/IsRRPFwHSMFLU=; b=aKq03qQnLQqLwkCHsAu/ETQEU/TCFLvN1U4GDPapRPjELp49qWv/QN73mlQlDfq+LJ VtxJo4wq+EzIAGC99yrwZptLtp1K9g3i4y3zmuiCNYpXszfn9DjW0aPjGR0odO1lKK+t qJhKdU3X0yxS+1pmYy5pekw30TkDc2W+ke4Eis1FWSIE8XgKQfS5iomXLnH2Eq1Awa/0 c6zFtQr+7Ybkx6VBulzQQXxVLIc5Xc86JLl+ktSM3GNklrj5sMQXcMdSXMeZZ3b2KPsV NIPUJLB50f7vT7L8LygwYUcunm1SAnlcp92g7yfzOQQiqT7xzJSRSsop4aPY9PB9ZMjn CtBw== X-Gm-Message-State: AOJu0Yz4orEu1ueXcTum6gpmkqpnBY/uAkBvRSDnuB2Xr1kOJHFVFKNK 3ZN6CzzsHaKfL5LJWOmzDTxUvgPz2A8eXAWEbH7NvHjCvk+VNlaIaqvk4r8zeOsW6r8u39Nnp8h ICMpd2Bzf5q+f6yYI8e6gDGJahuc02Q== X-Google-Smtp-Source: AGHT+IF4Ik6dQAvg2NNkKFGKTCG5mD14X+YEW6g3bH/qTxhwkRtrJ0AilIbgAqFfDIFDEyxAHwFqQOo8yeZj6EWPmjc= X-Received: by 2002:a19:4319:0:b0:52c:8591:1f7b with SMTP id 2adb3069b0e04-52ca6e659a9mr7595023e87.24.1718721907855; Tue, 18 Jun 2024 07:45:07 -0700 (PDT) MIME-Version: 1.0 References: <1399464798.20240617105808@yandex.ru> In-Reply-To: From: Dan Shelton Date: Tue, 18 Jun 2024 16:44:00 +0200 Message-ID: Subject: Re: Cygwin outputting message to stderr on dofork EAGAIN failure even when Python exception is caught and handled To: "cygwin@cygwin.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On Mon, 17 Jun 2024 at 18:03, Dale Lobb (Sys Admin) via Cygwin wrote: > > Greetings, Nicholas; > > > From: Cygwin On= Behalf Of Andrey Repin via Cygwin > > Sent: Monday, June 17, 2024 2:58 AM > > To: Nicholas Williams ; cygwin@cygwin.com > > Cc: Andrey Repin > > Subject: EXTERNAL SENDER: Re: Cygwin outputting message to stderr on do= fork EAGAIN failure even when Python exception is caught and handled > > > > Greetings, Nicholas Williams! > We have a Python (installed and run thr= ough Cygwin) process running on > Windows Server 2022 that was very, very o= ccasionally failing when subprocess.=E2=80=8Acheck_output was called: > 0 [= main] python3 28481 > > > > Greetings, Nicholas Williams! > > > > > We have a Python (installed and run through Cygwin) process running o= n > > > Windows Server 2022 that was very, very occasionally failing when sub= process.check_output was called: > > > > > 0 [main] python3 28481 dofork: child -1 - forked process 16856 died > > > unexpectedly, retry 0, exit code 0xC0000142, errno 11 > > > =E2=80=A6 > > > subprocess.check_output(["cygpath", "-w", directory.name], encodi= ng=3D"utf-8").strip() > > > File "/usr/lib/python3.9/subprocess.py", line 424, in check_output <> > > > <>return run(*popenargs, stdout=3DPIPE, timeout=3Dtimeout, check= =3DTrue, <> > > > 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 =3D _posixsubprocess.fork_exec( > > > BlockingIOError: [Errno 11] Resource temporarily unavailable > > > > > Setting aside for a minute the various reasons this might be happenin= g > > > occasionally, which we cannot solve for at this moment, the error num= ber > > > (EAGAIN) indicates that you should =E2=80=9Ctry again.=E2=80=9D So th= at=E2=80=99s exactly what we > > > did. We added a try/catch to the Python code to catch the BlockingIOE= rror > > > 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. W= e > > > output a warning to our log so that we don=E2=80=99t forget about the= problem, but > > > the warning only ever appears once, so retrying a single time seems t= o help. > > > > > However =E2=80=A6 even though Python handles the dofork error, turns = it into a > > > Python exception, and our code catches the Python exception and handl= es it > > > properly, Cygwin (not Python =E2=80=A6 Cygwin) still outputs a messag= e 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=E2=80=99re running] Does python require fork(), or can it use posix_spawn() in this case? Dan --=20 Dan Shelton - Cluster Specialist Win/Lin/Bsd