From: Vlad S. <vl...@cr...> - 2006-09-13 03:05:12
|
Had ns_proxy running, typed in nscp ns_shutdown and nsd crahsed 0xffffe410 in __kernel_vsyscall () (gdb) bt #0 0xffffe410 in __kernel_vsyscall () #1 0xb7d5b486 in __nanosleep_nocancel () from /lib/libc.so.6 #2 0xb7d5b2ab in sleep () from /lib/libc.so.6 #3 0xb62d701c in DnsPanic (fmt=0xb7f2d340 "nsthreads: %s failed in %s: %s") at nsdns.c:237 #4 0xb7eee03e in Tcl_PanicVA () from /usr/lib/libtcl8.4.so #5 0xb7eee0d7 in Tcl_Panic () from /usr/lib/libtcl8.4.so #6 0xb7f2b1fd in NsThreadFatal (func=0xb7f2db3a "Ns_CondDestroy", osfunc=0xb7f2db25 "pthread_cond_destroy", err=16) at error.c:64 #7 0xb7f2cb1c in Ns_CondDestroy (cond=0xb7f2e0f8) at pthread.c:553 #8 0xb4614855 in Ns_ProxyExit (arg=0xbf889858) at nsproxylib.c:2621 #9 0xb7f4bcef in RunCallbacks (cbPtr=<value optimized out>, reverse=0) at callbacks.c:490 #10 0xb7f5feea in Ns_Main (argc=8, argv=0xbf88ae44, initProc=0x8048620 <ServerInit>) at nsmain.c:838 #11 0x0804866f in main (argc=0, argv=0x1e313f8) at main.c:64 -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |
From: Zoran V. <zv...@ar...> - 2006-09-13 08:36:22
|
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 |
From: Vlad S. <vl...@cr...> - 2006-09-13 14:46:18
|
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 > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |
From: Zoran V. <zv...@ar...> - 2006-09-13 19:39:18
|
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 |
From: Vlad S. <vl...@cr...> - 2006-09-13 19:53:11
|
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 > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |
From: Zoran V. <zv...@ar...> - 2006-09-13 20:19:44
|
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 |
From: Vlad S. <vl...@cr...> - 2006-09-13 20:24:00
|
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 > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |
From: Stephen D. <sd...@gm...> - 2006-09-14 19:59:52
|
On 9/13/06, Zoran Vasiljevic <zv...@ar...> 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. |
From: Zoran V. <zv...@ar...> - 2006-09-14 20:04:51
|
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. |
From: Zoran V. <zv...@ar...> - 2006-09-14 20:48:27
|
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? |
From: Stephen D. <sd...@gm...> - 2006-09-14 21:02:02
|
On 9/14/06, Zoran Vasiljevic <zv...@ar...> 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! |
From: Zoran V. <zv...@ar...> - 2006-09-14 21:25:01
|
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=F3rks now. I will keep this in mind. |