Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: reentrant call #10

Open
lvsoso opened this issue Nov 3, 2017 · 0 comments
Open

RuntimeError: reentrant call #10

lvsoso opened this issue Nov 3, 2017 · 0 comments

Comments

@lvsoso
Copy link

lvsoso commented Nov 3, 2017

I came across the Error if I am not comment the "print" after "os.waitpid" when using the code from you github.
I search solution from the internet, it tell me that maybe caused by lock's problem.
So I comment that code and it runs normally.

code

(webserver3h.py from your github, I just add some function about handle some encoding for python3)

def grim_reaper(signum, frame):
    while True:
        try:
            pid, status = os.waitpid(
                -1,          # Wait for any child process
                 os.WNOHANG  # Do not block and return EWOULDBLOCK error
            )
            print(
                'Child {pid} terminated with status {status}\n'.format(pid=pid, status=status)
            )
        except OSError:
            return

Error

    httpd.serve_forever()
  File "webserver3.py", line 72, in serve_forever
    pid = os.fork()
  File "webserver3.py", line 22, in grim_reaper
    'Child {pid} terminated with status {status}\n'.format(pid=pid, status=status)
  File "webserver3.py", line 22, in grim_reaper
    'Child {pid} terminated with status {status}\n'.format(pid=pid, status=status)
RuntimeError: reentrant call inside <_io.BufferedWriter name='<stdout>'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant