This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python on Cygwin: subprocess.call BlockingIOError: [Errno 11] Resource temporarily unavailable
Type: resource usage Stage:
Components: IO Versions: Python 3.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: dellair.jie, eric.smith
Priority: normal Keywords:

Created on 2014-04-30 09:15 by dellair.jie, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg217585 - (view) Author: dellair jie (dellair.jie) Date: 2014-04-30 09:15
Folks,

I am running Python 3.4 on Cygwin 1.7.17 on Windows 2008.
The constant error I get is:

Traceback (most recent call last):
  File "M:/sb3_ljie/bce/cmTools/lib/CC.py", line 321, in standAlone
    results = Process.execute (cmd = cmd, opts = opts)
  File "M:/sb3_ljie/bce/cmTools/lib/Process.py", line 327, in execute
    timeout = timeout)
  File "/usr/local/lib/python3.4/subprocess.py", line 535, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/local/lib/python3.4/subprocess.py", line 848, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.4/subprocess.py", line 1379, in _execute_child
    restore_signals, start_new_session, preexec_fn)
BlockingIOError: [Errno 11] Resource temporarily unavailable

Python script is invoked via socket (server runs Cygwin inetd).

While the script (snippet) Process.py is as below with relatively large data return:
import subprocess, os, tempfile, re
def execute (cmd = None,
             opts = None,
             log = None,
             verify = False,
             cmdlog = False,
             audit = False,
             logappend = False,
             ignorestatus = False,
             umask = None,
             host = None,
             interrupt = None,
             timeout = None,
             forceaudit = False):
    global __signal
    global __signalList
    returnData = {"status": 0, "rawstatus": 0, "interrupt": 0,
                  "stdout": None, "stderr": None}
    os.environ["ENV"] = ""

    stdOutHandle, stdOut = tempfile.mkstemp (text = True)
    stdErrHandle, stdErr = tempfile.mkstemp (text = True)

    if re.match ("\s", cmd): cmd = "'" + cmd + "'"
    cmd = [cmd]
    opts = opts.split()
    cmd.extend (opts)

    if not verify:
        if umask: originalUmask = os.umask (umask)

        if interrupt:
            for idex, item in enumerate (__signalList):
                if item: signal.signal (idex, interrupt)

        __signal = 0

        returnData["rawstatus"] = subprocess.call (cmd, stdout = stdOutHandle,
                                                   stderr = stdErrHandle,
                                                   timeout = timeout)
        returns = returnData["rawstatus"]
    os.close (stdOutHandle)
    os.close (stdErrHandle)

Br,
Dellair
msg217587 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2014-04-30 09:50
Can you provide a working example? How are you calling execute()? What are __signal and __signalList set to?

Note that the default of "None" for cmd can't ever work, due to calling re.match ("\s", cmd).
msg217603 - (view) Author: dellair jie (dellair.jie) Date: 2014-04-30 11:24
The value of __signal and __signalList:
__signal=0
__signalList=[None] * 256
    __signalList[signal.SIGHUP] = signalHandler
    __signalList[signal.SIGQUIT] = signalHandler
    __signalList[signal.SIGUSR1] = signalHandler
    __signalList[signal.SIGUSR2] = signalHandler

    signal.signal (signal.SIGHUP,  signalHandler)
    signal.signal (signal.SIGQUIT, signalHandler)
    signal.signal (signal.SIGUSR2, signalHandler)
    signal.signal (signal.SIGUSR1, signalHandler)

I think those are irrelevant though.

cmd is a command and that is working.
msg217605 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2014-04-30 12:17
I'd like to help with this, but unless you can provide a script I can run that shows the problem, I can't. I don't have the time to figure out what parameters I need to pass in to cause the problem. Sorry.
msg217920 - (view) Author: dellair jie (dellair.jie) Date: 2014-05-05 12:29
Eric,

Very much appreciated for your offer to help.
This issue is with Cygwin fork(), documented here:
http://cygwin.com/faq.html#faq.using.fixing-fork-failures

I am closing the issue.
Have a great day!
History
Date User Action Args
2022-04-11 14:58:03adminsetgithub: 65591
2014-05-05 12:29:37dellair.jiesetstatus: open -> closed
resolution: not a bug
messages: + msg217920
2014-04-30 12:17:43eric.smithsetmessages: + msg217605
2014-04-30 11:24:00dellair.jiesetmessages: + msg217603
2014-04-30 09:50:23eric.smithsetnosy: + eric.smith
messages: + msg217587
2014-04-30 09:16:41dellair.jiesettype: resource usage
components: + IO
2014-04-30 09:15:44dellair.jiecreate