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

ForkingServer hang #15

Closed
tomerfiliba opened this issue Mar 2, 2011 · 1 comment
Closed

ForkingServer hang #15

tomerfiliba opened this issue Mar 2, 2011 · 1 comment
Labels
Bug Confirmed bug

Comments

@tomerfiliba
Copy link
Collaborator

mman Show activity 3/1/10
Hello all,
I'm using the ForkingServer and I have noticed that the server-side
hangs
when a client disconnects. Looking through the code I found that the
SIGCHLD
handler inside the ForkingServer class needs some checks. Below is a
patch
that fixes the problem. Tomer, feel free to include this in the rpyc
distribution.
I'm using python 2.6.4 here.


diff -ur rpyc-3.0.7-py2.6/utils/server.py rpyc-3.0.7-py2.6.my/utils/
server.py
--- rpyc-3.0.7-py2.6/utils/server.py    2009-09-22 14:38:28.000000000
+0300
+++ rpyc-3.0.7-py2.6.my/utils/server.py 2010-03-01 12:44:36.000000000
+0200
@@ -202,11 +202,15 @@
     def _handle_sigchld(signum, unused):
         try:
             while True:
-                os.waitpid(-1, os.WNOHANG)
+                r = os.waitpid(-1, os.WNOHANG)
+                print "waitpid returned %s" % repr(r)
+                if r == (0, 0):
+                    time.sleep(1)
+                else:
+                    print "our child %d terminated" % r[0]
+                    break
         except OSError:
             pass
-        # re-register signal handler (see man signal(2), under
Portability)
-        signal.signal(signal.SIGCHLD, self._handle_sigchld)

     def _accept_method(self, sock):
         pid = os.fork()
@tomerfiliba
Copy link
Collaborator Author

fixes a28b882; closed by 7eb48a4; closed by 7eb48a4; closed by 7eb48a4; closed by 7eb48a4; closed by 7eb48a4; closed by 7eb48a4;

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

1 participant