mynicolas / web-shell

Automatically exported from code.google.com/p/web-shell
2 stars 0 forks source link

Fast login/logout/close kills webshell #32

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. SSL connect, log in, log out and close the browser window all within a
few seconds
2. Wait 60s
3. webshell.py crashes. 

What is the expected output? What do you see instead?

Expect webshell, but it's dead. Can't log in anymore.

What version of the product are you using? On what operating system?

0.9.6 with Python 2.3.4 on Linux 2.6.18

Please provide any additional information below.

Stack dump:

WebShell (https) at 0.0.0.0, port 8022
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.3/threading.py", line 436, in __bootstrap
    self.run()
  File "/usr/lib/python2.3/threading.py", line 416, in run
    self.__target(*self.__args, **self.__kwargs)
  File "webshell.py", line 1230, in proc_thread
    (fds, fd2sid) = self.proc_getalive()
  File "webshell.py", line 1023, in __call__
    r = self.orig(*l)
  File "webshell.py", line 1220, in proc_getalive
    self.proc_bury(sid)
  File "webshell.py", line 1158, in proc_bury
    self.proc_waitfordeath(sid)
  File "webshell.py", line 1144, in proc_waitfordeath
    del self.session[sid]['fd']
KeyError: 'fd'

This svn diff seems to fix it but hasn't been well tested.
It just guards against 'fd' and 'sid' going missing.  I guess you
could just check if the session is already dead instead; whatever...

Index: webshell.py
===================================================================
--- webshell.py (revision 72)
+++ webshell.py (working copy)
@@ -1141,12 +1141,12 @@
                        os.close(self.session[sid]['fd'])
                except (KeyError, IOError, OSError):
                        pass
-               del self.session[sid]['fd']
+               self.session[sid].pop('fd', None)
                try:
                        os.waitpid(self.session[sid]['pid'], 0)
                except (KeyError, IOError, OSError):
                        pass
-               del self.session[sid]['pid']
+               self.session[sid].pop('pid', None)
                self.session[sid]['state'] = 'dead'
                return True
        def proc_bury(self, sid):

Original issue reported on code.google.com by pontus.h...@gmail.com on 15 Aug 2007 at 1:50

GoogleCodeExporter commented 8 years ago
Thnx!

Original comment by mre...@gmail.com on 19 Sep 2007 at 5:43

GoogleCodeExporter commented 8 years ago
Could you please test the fix attached in issue 43 (or alternatively, the new
WebShell 0.9.6 release)? It fixes a similar (possibly the same) problem.

Original comment by aleksand...@gmail.com on 21 Oct 2008 at 9:35