From: Eden Kirin on 19 Nov 2009 04:32 Diez B. Roggisch wrote: > - save a reference to sys.stdout *before* invoking the server > - compare to it after interruption. If it has changed, you at least know > that somebody messed with it, and can beat him or whatever you see fit. Thanks for the help. Finally, I dropped python-scgi module and I wrote my own SCGI server. There was not only the problem with stdout, but one much serious which made it unusable to me. Every SCGI request was forked as a new process, without the ability to access the shared globals within the project. -- www.vikendi.net -/- www.supergrupa.com
From: Дамјан Георгиевски on 19 Nov 2009 10:45 > everything works just fine, but one thing bothers me. All prints after > try-except block are executed twice after the Ctrl+C is pressed! > > test.py: > #------------------------- > from scgi.scgi_server import SCGIServer > > n = 0 > print "Starting server." > > try: > SCGIServer().serve() > except (KeyboardInterrupt, SystemExit): > print "Exception!" > > # print lines are executed twice (?!) > n += 1 > print "Terminating server, attempt %d." % n > n += 1 > print "Check n: %d." % n > #------------------------- SCGIServer().serve() forks, so it seems that there are 2 python processes continuing to run after SCGIServer().serve() -- дамјан ((( http://damjan.softver.org.mk/ ))) Spammers scratch here with a diamond to find my address: |||||||||||||||||||||||||||||||||||||||||||||||
From: Eden Kirin on 19 Nov 2009 12:03
Дамјан Георгиевски wrote: > SCGIServer().serve() forks, so it seems that there are 2 python > processes continuing to run after SCGIServer().serve() I noticed that which makes it unusable to me. Also, it took me almost whole day to realize this. I'm adopting a huge application to work with SCGI which shares a certain amount of data between working threads and SCGI handler. I couldn't realize the cause of erratic and unconsistent data behaviour. After diving into python-scgi code, I gave it up and wrote my own SCGI server. -- www.vikendi.net -/- www.supergrupa.com |