Re: [naviserver-devel] ns_proxy crash
On 14.09.2006, at 23:02, Stephen Deasey wrote: AtShutdown callbacks are called twice: the first time is to allow you to notify threads that they should begin cleaning up for shutdown; the second time you should actually wait for the shutdown to complete, taking note of the absolute timeout value. Look at some of the existing code that handles this. There's 3 or 4 AtShutdown procs in the core. The interface is kind of ugly, I agree. I always have to look up what I'm supposed to do. Suggestions appreciated! Well, no suggestions. It is rather simple: either you pass the toutPtr in which case you need to wait or yout pass NULL in which case you prepare for waiting. This wórks now. I will keep this in mind.
Re: [naviserver-devel] ns_proxy crash
On 9/14/06, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote: On 14.09.2006, at 21:59, Stephen Deasey wrote: > Currently you're cleaning up with a AtExit handler and manually > calculating a timeout to wait for proxies to exit. I think you > really want an AtShutdown callback. These already handle a > notification and then timeout sequence. > > I think at the moment a clean exit will take shutdown-timeout + > proxy-shutdown-timeout, which might be surprising to people. > Hey, isn't AtShutdown done per-thread? [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nsproxy: shutdown started [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: driver: shutdown complete [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: spooler0: shutdown complete [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nsproxy: shutdown pending [14/Sep/2006:22:44:08][13827.41968128][-nsproxy:reap-] Notice: exiting [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nsproxy: shutdown complete [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nslog: closed '/usr/local/ns/logs/access.log' [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: nsproxy: shutdown started [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: nsproxy: shutdown complete [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: nsmain: NaviServer/4.99.2 exiting I have the proc running twice which should'nt be? Was the AtExit a better solution? AtShutdown callbacks are called twice: the first time is to allow you to notify threads that they should begin cleaning up for shutdown; the second time you should actually wait for the shutdown to complete, taking note of the absolute timeout value. Look at some of the existing code that handles this. There's 3 or 4 AtShutdown procs in the core. The interface is kind of ugly, I agree. I always have to look up what I'm supposed to do. Suggestions appreciated!
Re: [naviserver-devel] ns_proxy crash
On 14.09.2006, at 21:59, Stephen Deasey wrote: Currently you're cleaning up with a AtExit handler and manually calculating a timeout to wait for proxies to exit. I think you really want an AtShutdown callback. These already handle a notification and then timeout sequence. I think at the moment a clean exit will take shutdown-timeout + proxy-shutdown-timeout, which might be surprising to people. Hey, isn't AtShutdown done per-thread? [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nsproxy: shutdown started [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: driver: shutdown complete [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: spooler0: shutdown complete [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nsproxy: shutdown pending [14/Sep/2006:22:44:08][13827.41968128][-nsproxy:reap-] Notice: exiting [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nsproxy: shutdown complete [14/Sep/2006:22:44:08][13827.41969152][-shutdown-] Notice: nslog: closed '/usr/local/ns/logs/access.log' [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: nsproxy: shutdown started [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: nsproxy: shutdown complete [14/Sep/2006:22:44:08][13827.2684415384][-main-] Notice: nsmain: NaviServer/4.99.2 exiting I have the proc running twice which should'nt be? Was the AtExit a better solution?
Re: [naviserver-devel] ns_proxy crash
On 14.09.2006, at 21:59, Stephen Deasey wrote: AtShutdown callback Yes. That's it. Ah. with that waiting mess I just wanted to make sure the server will eventually exit even if I mess something up in the reaper thread and this stucks somewhere.
Re: [naviserver-devel] ns_proxy crash
On 9/13/06, Zoran Vasiljevic <[EMAIL PROTECTED]> wrote: On 13.09.2006, at 04:55, Vlad Seryakov wrote: > Had ns_proxy running, typed in nscp ns_shutdown and nsd crahsed Eh... this is true. In the attempt to cleanup as much as possible I prematurely cleaned a pool having references to it. Actually, pools still having references to them should not be touched and should rather leak. OTOH, at the shutdown, there should be no references as all threads should have already been exited. I guess at this point we have still some trouble... The immediate and not clean solution is just to skip such pools and let them leak. I'm emitting the log message in such case as the reminder: [13/Sep/2006:10:22:37][1132.2684415384][-main-] Warning: nsproxy: pool "test" not destroyed, has 1 active slaves I do not think it is possible to avoid this, after thinking about this for a while. But still, lets leave this here as we might be more clever in the future. Currently you're cleaning up with a AtExit handler and manually calculating a timeout to wait for proxies to exit. I think you really want an AtShutdown callback. These already handle a notification and then timeout sequence. I think at the moment a clean exit will take shutdown-timeout + proxy-shutdown-timeout, which might be surprising to people.
Re: [naviserver-devel] ns_proxy crash
No hurry, i am doing this the old-fashioned way using ns_thread for now but ns_job-like way of handling proxies would be nice Zoran Vasiljevic wrote: On 13.09.2006, at 21:52, Vlad Seryakov wrote: ok, for example i schedule encoder ns_proxy configure channel1 -minslaves 0 -maxslaves 1 set h [ns_proxy get channel1] ns_proxy send $h "/usr/bin/mencoder " now proxy is running and pool channel1 is taken, in another thread i cannot just issue ns_proxy get channel1, it will hang. I can run ns_proxy active or ns_proxy handles but how i would know about this particular process in order to use ns_kill? I believe that ns_proxy as-implemtented now is not entirely correctly, hence it opens whole lotta questions as yours above. I'm gonna have to (partly) rewrite it tomorrow. But before I do that, the answers: Normally a proxy pool is just a collection of proxy-structures. Each proxy structure is used to communicate with (and control) an process instance. Each thread can acquire a number of such structures from the pool. After doing so, it has sole ownership of the proxy(es) and other threads have no access to them. When a thread is done with the proxy, it can return it to pool in which case some other threads can acquire it. So, the proxy structure cannot be shared among threads. There is no locking that would support that. Now we may think about adding this, but to be honest I haven't thougth about that at all yet. My first goal is to have a properly working ns_proxy module. After we get this stable (which it still is not) we can think about extending it. Cheers, Zoran - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel -- Vlad Seryakov 571 262-8608 office [EMAIL PROTECTED] http://www.crystalballinc.com/vlad/
Re: [naviserver-devel] ns_proxy crash
On 13.09.2006, at 21:52, Vlad Seryakov wrote: ok, for example i schedule encoder ns_proxy configure channel1 -minslaves 0 -maxslaves 1 set h [ns_proxy get channel1] ns_proxy send $h "/usr/bin/mencoder " now proxy is running and pool channel1 is taken, in another thread i cannot just issue ns_proxy get channel1, it will hang. I can run ns_proxy active or ns_proxy handles but how i would know about this particular process in order to use ns_kill? I believe that ns_proxy as-implemtented now is not entirely correctly, hence it opens whole lotta questions as yours above. I'm gonna have to (partly) rewrite it tomorrow. But before I do that, the answers: Normally a proxy pool is just a collection of proxy-structures. Each proxy structure is used to communicate with (and control) an process instance. Each thread can acquire a number of such structures from the pool. After doing so, it has sole ownership of the proxy(es) and other threads have no access to them. When a thread is done with the proxy, it can return it to pool in which case some other threads can acquire it. So, the proxy structure cannot be shared among threads. There is no locking that would support that. Now we may think about adding this, but to be honest I haven't thougth about that at all yet. My first goal is to have a properly working ns_proxy module. After we get this stable (which it still is not) we can think about extending it. Cheers, Zoran
Re: [naviserver-devel] ns_proxy crash
ok, for example i schedule encoder ns_proxy configure channel1 -minslaves 0 -maxslaves 1 set h [ns_proxy get channel1] ns_proxy send $h "/usr/bin/mencoder " now proxy is running and pool channel1 is taken, in another thread i cannot just issue ns_proxy get channel1, it will hang. I can run ns_proxy active or ns_proxy handles but how i would know about this particular process in order to use ns_kill? Zoran Vasiljevic wrote: On 13.09.2006, at 16:45, Vlad Seryakov wrote: Can nsproxy be extended to be able to kill any particular process without issuing nsproxy get first, get hangs if no available process are in the pool. It would be nice to be able to query how many are running and be able to kill by pid or name, does not matter. Any particular process??? What do you mean about that? There is ns_kill command for that. But, I'd say I doi not understand the question... Can you put in more detail? Cheers Zoran - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel -- Vlad Seryakov 571 262-8608 office [EMAIL PROTECTED] http://www.crystalballinc.com/vlad/
Re: [naviserver-devel] ns_proxy crash
On 13.09.2006, at 16:45, Vlad Seryakov wrote: Can nsproxy be extended to be able to kill any particular process without issuing nsproxy get first, get hangs if no available process are in the pool. It would be nice to be able to query how many are running and be able to kill by pid or name, does not matter. Any particular process??? What do you mean about that? There is ns_kill command for that. But, I'd say I doi not understand the question... Can you put in more detail? Cheers Zoran
Re: [naviserver-devel] ns_proxy crash
The other night i was trying to use nsproxy for long running processes, like encoding with ability to work with them like ns_job queues, define min. max, submit in the background, check who is running, kill if have to. Can nsproxy be extended to be able to kill any particular process without issuing nsproxy get first, get hangs if no available process are in the pool. It would be nice to be able to query how many are running and be able to kill by pid or name, does not matter. Zoran Vasiljevic wrote: On 13.09.2006, at 04:55, Vlad Seryakov wrote: Had ns_proxy running, typed in nscp ns_shutdown and nsd crahsed Eh... this is true. In the attempt to cleanup as much as possible I prematurely cleaned a pool having references to it. Actually, pools still having references to them should not be touched and should rather leak. OTOH, at the shutdown, there should be no references as all threads should have already been exited. I guess at this point we have still some trouble... The immediate and not clean solution is just to skip such pools and let them leak. I'm emitting the log message in such case as the reminder: [13/Sep/2006:10:22:37][1132.2684415384][-main-] Warning: nsproxy: pool "test" not destroyed, has 1 active slaves I do not think it is possible to avoid this, after thinking about this for a while. But still, lets leave this here as we might be more clever in the future. Please checkout and try again. Cheers Zoran - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ naviserver-devel mailing list naviserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/naviserver-devel -- Vlad Seryakov 571 262-8608 office [EMAIL PROTECTED] http://www.crystalballinc.com/vlad/
Re: [naviserver-devel] ns_proxy crash
On 13.09.2006, at 04:55, Vlad Seryakov wrote: Had ns_proxy running, typed in nscp ns_shutdown and nsd crahsed Eh... this is true. In the attempt to cleanup as much as possible I prematurely cleaned a pool having references to it. Actually, pools still having references to them should not be touched and should rather leak. OTOH, at the shutdown, there should be no references as all threads should have already been exited. I guess at this point we have still some trouble... The immediate and not clean solution is just to skip such pools and let them leak. I'm emitting the log message in such case as the reminder: [13/Sep/2006:10:22:37][1132.2684415384][-main-] Warning: nsproxy: pool "test" not destroyed, has 1 active slaves I do not think it is possible to avoid this, after thinking about this for a while. But still, lets leave this here as we might be more clever in the future. Please checkout and try again. Cheers Zoran