IsDaZope: a Zope checker and relauncher
Hi there, Because I was hurt by the Zope hanging problem, and because I wanted to contribute something back to the Zope community, I've written a python script which can periodically check if your Zope server is still serving requests correctly, and restart it if it's not the case. It's called IsDaZope and you can get it as a tar+gzip file, as well as a document which explains how to use it, at: http://www.zope.org/Members/jerome Unfortunately, Murphy's law has hurt me too: my Zope served has not hanged today so I was unable to test my program in this situation. I hope it will hang tomorrow ;-) I've tested it when manually shutting down Zope, and it works fine: it can detect this situation and restart Zope. You can also use isdazope to detect if a particular HTTP server seems to be a Zope server or not. In order for isdazope to work correctly you should: - read the documentation and use the correct arguments for your situation on the command line - launch it AFTER having launched Zope. I suggest you launch it in the background. isdazope is distributed under the Gnu General Public License. Please feel free to send me any feedback, especially if you find this software useful or too buggy. Enjoy. Jerome Alet
You want to hang your Zope? Create this DTMLMethod inside a ZClass that inherits from nothing: <dtml-in "_.range(0, 105, 5)"> <option value="<dtml-var "_.float(_['sequence-item'])/1000">"> <dtml-var "_.float(_['sequence-item'])/10">% </option> </dtml-in> Don't ask. Make sure there are leading spaces in front of the <option> lines just like above. I just found out that this does it everytime on 2.1.6. Funny how a hanging bug is a good thing sometimes. All my best, Jerome ALET writes:
Hi there,
Because I was hurt by the Zope hanging problem, and because I wanted to contribute something back to the Zope community, I've written a python script which can periodically check if your Zope server is still serving requests correctly, and restart it if it's not the case.
It's called IsDaZope and you can get it as a tar+gzip file, as well as a document which explains how to use it, at:
http://www.zope.org/Members/jerome
Unfortunately, Murphy's law has hurt me too: my Zope served has not hanged today so I was unable to test my program in this situation. I hope it will hang tomorrow ;-)
I've tested it when manually shutting down Zope, and it works fine: it can detect this situation and restart Zope.
You can also use isdazope to detect if a particular HTTP server seems to be a Zope server or not.
In order for isdazope to work correctly you should:
- read the documentation and use the correct arguments for your situation on the command line
- launch it AFTER having launched Zope. I suggest you launch it in the background.
isdazope is distributed under the Gnu General Public License.
Please feel free to send me any feedback, especially if you find this software useful or too buggy.
Enjoy.
Jerome Alet
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
On Tue, 25 Apr 2000, Jason Spisak wrote:
You want to hang your Zope?
Create this DTMLMethod inside a ZClass that inherits from nothing:
<dtml-in "_.range(0, 105, 5)"> <option value="<dtml-var "_.float(_['sequence-item'])/1000">"> <dtml-var "_.float(_['sequence-item'])/10">% </option> </dtml-in>
Ok, it hangs zope. Now I can hang it when I want. unfortunately my program doesn't detect it, it seems that urllib.urlopen() blocks and doesn't allow my alarm handler to be called in this situation. here's a part of the program: # # now we set the alarm handler and set the timeout signal.signal(signal.SIGALRM, alarm_handler) signal.alarm(timeout) # # now we try to open the connection url = urllib.urlopen("http://%s:%i" % (host, port)) # # stop the alarm signal.alarm(0) Anyone has an idea of what is wrong in this code ? thanks. Jerome
On Wed, 26 Apr 2000, Jerome Alet wrote:
unfortunately my program doesn't detect it, it seems that urllib.urlopen() blocks and doesn't allow my alarm handler to be called in this situation.
Python does not deliver signals while hang in C (or even worse, in system calls). Well-known Python deficency :( Go multiprocess - either threading or forking. Or select()... Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
On Wed, 26 Apr 2000, Oleg Broytmann wrote:
On Wed, 26 Apr 2000, Jerome Alet wrote:
unfortunately my program doesn't detect it, it seems that urllib.urlopen() blocks and doesn't allow my alarm handler to be called in this situation.
Python does not deliver signals while hang in C (or even worse, in system calls). Well-known Python deficency :( Go multiprocess - either threading or forking. Or select()...
Yes, I've found the problem just after (unfortunately) having posted my previous message: the socket module, used by httplib which is itself used by urllib, is not a pure python module, but a C module. I knew the problem because I had to deal with it before. I'm currently downloading the python source tarball to look at the socket module to know if I can use threads or if they are blocked during the connect the same way that signals are. thanks for the help, I'll try to post a new version today. bye, Jerome
On Wed, 26 Apr 2000, Jerome Alet wrote:
I'm currently downloading the python source tarball to look at the socket module to know if I can use threads or if they are blocked during the connect the same way that signals are.
Threads or select() are Ok while connecting and/or transmitting data... Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
Jerome:
Ok, it hangs zope. Now I can hang it when I want.
Scarey that this is a good thing.
unfortunately my program doesn't detect it, it seems that urllib.urlopen() blocks and doesn't allow my alarm handler to be called in this situation.
I'm not really sure, but I don't think it crashes the thread/Zope it just spins it out. Therefore the client (in this case your script) thinks that it will get there eventually and just waits. It's not that the thread or Zope isn't there, it's just really busy. BTW, if you kill that spinning thread, Zope returns to normal op. All my best, Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
On Wed, 26 Apr 2000, Jason Spisak wrote:
Jerome:
Ok, it hangs zope. Now I can hang it when I want.
Scarey that this is a good thing.
yes, but it's very useful...
I'm not really sure, but I don't think it crashes the thread/Zope it just spins it out. Therefore the client (in this case your script) thinks that it will get there eventually and just waits. It's not that the thread or Zope isn't there, it's just really busy.
I don't know if you're right because when I launch your dtml method Zope seems to be completely frozen, even for other browsers from somewhere else so maybe more than one Zope thread is blocked.
BTW, if you kill that spinning thread, Zope returns to normal op.
Not tested. How do you detect which thread to kill ? Anyway I'm glad your method helped me debug the program which works fine for me now. bye, and thanks again. Jerome
I'm pleased to announce that isdazope 0.2 is available for download from http://www.zope.org/Members/jerome it's distributed under the GNU GPL. It now correctly detects and handles Zope hangings like those generated by this small dtml method: On Tue, 25 Apr 2000, Jason Spisak wrote:
You want to hang your Zope?
Create this DTMLMethod inside a ZClass that inherits from nothing:
<dtml-in "_.range(0, 105, 5)"> <option value="<dtml-var "_.float(_['sequence-item'])/1000">"> <dtml-var "_.float(_['sequence-item'])/10">% </option> </dtml-in>
signal handling was replaced with threads, because signals were blocked during the call to the socket module from urllib (via httplib), and it seems to finally work correctly now. feel free to send any feedback. thanks. Jerome
participants (4)
-
Jason Spisak -
Jerome ALET -
Jerome Alet -
Oleg Broytmann