Re: kill without 'KILL does not work for PicoLisp processes
Hi Thorsten, is it normal that a simple 'kill' won't kill PicoLisp processes, only with option 'KILL it works? No. A normal kill with SIGTERM (i.e. -15) should work. SIGKILL (i.e. -9) should be used only in extreme emergencies, because it may cause the loss of data (resulting in a corrupted database in the worst case)! Usually a $ killall picolisp or $ killall pil should do. It should be noted, however, that PicoLisp catches some signals: 1. SIGPIPE, SIGTTIN and SIGTTOU are ignored. 2. SIGIO is caught and handled in the 'sigio' function handler. 3. SIGHUP is caught and handled in the '*Hup' global. 4. SIGUSR1 and SIGUSR2 are handled in the '*Sig1' and '*Sig2' globals. 5. SIGALRM is used for the 'alarm' and 'abort' functions. 6. SIGCHLD is handled internally for the management of child processes. 7. SIGINT is caught only in the REPL, and causes a console break. A process running without a REPL is terminated. 8. SIGTSTP is used in the REPL to suspend the forground PicoLisp process. The normal (default) signal SIGTERM causes the termination of the running PicoLisp process with 'bye'. BUT: 1. If that process has still running child processes, it sends SIGTERM recursively to all children first, and waits for them to terminate. Then it terminates itself. 2. During certain phases of program execution, the PicoLisp interpreter blocks this and/or other signals. This may be in a 'protect'ed code block, or during critical database operations. This will only delay the handing of those interrupts (not ignore them). I hope I didn't forget anything :) ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: kill without 'KILL does not work for PicoLisp processes
Alexander Burger a...@software-lab.de writes: Hi Alex, is it normal that a simple 'kill' won't kill PicoLisp processes, only with option 'KILL it works? No. A normal kill with SIGTERM (i.e. -15) should work. SIGKILL (i.e. -9) should be used only in extreme emergencies, because it may cause the loss of data (resulting in a corrupted database in the worst case)! Usually a $ killall picolisp or $ killall pil should do. It should be noted, however, that PicoLisp catches some signals: 1. SIGPIPE, SIGTTIN and SIGTTOU are ignored. 2. SIGIO is caught and handled in the 'sigio' function handler. 3. SIGHUP is caught and handled in the '*Hup' global. 4. SIGUSR1 and SIGUSR2 are handled in the '*Sig1' and '*Sig2' globals. 5. SIGALRM is used for the 'alarm' and 'abort' functions. 6. SIGCHLD is handled internally for the management of child processes. 7. SIGINT is caught only in the REPL, and causes a console break. A process running without a REPL is terminated. 8. SIGTSTP is used in the REPL to suspend the forground PicoLisp process. The normal (default) signal SIGTERM causes the termination of the running PicoLisp process with 'bye'. BUT: 1. If that process has still running child processes, it sends SIGTERM recursively to all children first, and waits for them to terminate. Then it terminates itself. 2. During certain phases of program execution, the PicoLisp interpreter blocks this and/or other signals. This may be in a 'protect'ed code block, or during critical database operations. This will only delay the handing of those interrupts (not ignore them). I hope I didn't forget anything :) Guess not, that reads like an exhaustive treatment ;) Thanks for the info. I ran into this problem when experimenting with the web-framework and my app got into a bad state. When restarting then, PicoLisp tells me something like 'Port is already used', so I tried to kill the still running (*) PicoLisp processes with a simple 'kill PID', but to no avail. [* are they still running? 'ps' shows them with a '?', and I shutted them down on the command-line, so they shouldn't. But somehow they still block the port, and the more I shut down, the more are shown by 'ps'] May that be because things went wrong during debugging when some database operation failed? I have no idea ... -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: kill without 'KILL does not work for PicoLisp processes
On Wed, 17 Jul 2013 09:22:14 +0200 Thorsten Jolitz tjol...@gmail.com wrote: ..[snip].. I ran into this problem when experimenting with the web-framework and my app got into a bad state. When restarting then, PicoLisp tells me something like 'Port is already used', so I tried to kill the still running (*) PicoLisp processes with a simple 'kill PID', but to no avail. [* are they still running? 'ps' shows them with a '?', and I shutted them down on the command-line, so they shouldn't. But somehow they still block the port, and the more I shut down, the more are shown by 'ps'] ..[snip].. Sorry for asking the obvious question, but have you waited the couple of minutes needed for the kernel (depending on which kernel) to eventually clean orphaned ports itself? It *may* actually just be the port remaining open because the owning process didn't cleanly shut it?: as mentioned here http://superuser.com/a/127865 -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: kill without 'KILL does not work for PicoLisp processes
Rowan Thorpe ro...@rowanthorpe.com writes: On Wed, 17 Jul 2013 09:22:14 +0200 Thorsten Jolitz tjol...@gmail.com wrote: ..[snip].. I ran into this problem when experimenting with the web-framework and my app got into a bad state. When restarting then, PicoLisp tells me something like 'Port is already used', so I tried to kill the still running (*) PicoLisp processes with a simple 'kill PID', but to no avail. [* are they still running? 'ps' shows them with a '?', and I shutted them down on the command-line, so they shouldn't. But somehow they still block the port, and the more I shut down, the more are shown by 'ps'] ..[snip].. Sorry for asking the obvious question, but have you waited the couple of minutes needed for the kernel (depending on which kernel) to eventually clean orphaned ports itself? It *may* actually just be the port remaining open because the owning process didn't cleanly shut it?: as mentioned here http://superuser.com/a/127865 Not obvious for me, obviously, but definitely the right question - no I did not wait, and I did not know I have to wait a couple of minutes. So thats probably the root of the problem, unrelated to PicoLisp. Though a bit of a hassle, since it takes away the huge advantage of PicoLisp's millisecond start-up time somehow, and shutting down a PicoLisp process and restart is not a prime option anymore if a couple of minutes waiting are involved. Thanks for the interesting link! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: kill without 'KILL does not work for PicoLisp processes
When developing web apps I keep the code for the server and the rest separate and reload the rest on every request. No need for restarts at all that way. Unless you're actually fiddling with the actual server code, then it can't be helped I suppose... On Wed, Jul 17, 2013 at 3:33 PM, Thorsten Jolitz tjol...@gmail.com wrote: Rowan Thorpe ro...@rowanthorpe.com writes: On Wed, 17 Jul 2013 09:22:14 +0200 Thorsten Jolitz tjol...@gmail.com wrote: ..[snip].. I ran into this problem when experimenting with the web-framework and my app got into a bad state. When restarting then, PicoLisp tells me something like 'Port is already used', so I tried to kill the still running (*) PicoLisp processes with a simple 'kill PID', but to no avail. [* are they still running? 'ps' shows them with a '?', and I shutted them down on the command-line, so they shouldn't. But somehow they still block the port, and the more I shut down, the more are shown by 'ps'] ..[snip].. Sorry for asking the obvious question, but have you waited the couple of minutes needed for the kernel (depending on which kernel) to eventually clean orphaned ports itself? It *may* actually just be the port remaining open because the owning process didn't cleanly shut it?: as mentioned here http://superuser.com/a/127865 Not obvious for me, obviously, but definitely the right question - no I did not wait, and I did not know I have to wait a couple of minutes. So thats probably the root of the problem, unrelated to PicoLisp. Though a bit of a hassle, since it takes away the huge advantage of PicoLisp's millisecond start-up time somehow, and shutting down a PicoLisp process and restart is not a prime option anymore if a couple of minutes waiting are involved. Thanks for the interesting link! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: kill without 'KILL does not work for PicoLisp processes
Henrik Sarvell hsarv...@gmail.com writes: Hi Henrik, When developing web apps I keep the code for the server and the rest separate and reload the rest on every request. No need for restarts at all that way. interesting idea, not sure how you actually do that, but would make things smoother in the not so rare case of reaching a 'bad' state during development. Unless you're actually fiddling with the actual server code, then it can't be helped I suppose... I don't, so that would not be a problem. On Wed, Jul 17, 2013 at 3:33 PM, Thorsten Jolitz tjol...@gmail.com wrote: Rowan Thorpe ro...@rowanthorpe.com writes: On Wed, 17 Jul 2013 09:22:14 +0200 Thorsten Jolitz tjol...@gmail.com wrote: ..[snip].. I ran into this problem when experimenting with the web-framework and my app got into a bad state. When restarting then, PicoLisp tells me something like 'Port is already used', so I tried to kill the still running (*) PicoLisp processes with a simple 'kill PID', but to no avail. [* are they still running? 'ps' shows them with a '?', and I shutted them down on the command-line, so they shouldn't. But somehow they still block the port, and the more I shut down, the more are shown by 'ps'] ..[snip].. Sorry for asking the obvious question, but have you waited the couple of minutes needed for the kernel (depending on which kernel) to eventually clean orphaned ports itself? It *may* actually just be the port remaining open because the owning process didn't cleanly shut it?: as mentioned here http://superuser.com/a/127865 Not obvious for me, obviously, but definitely the right question - no I did not wait, and I did not know I have to wait a couple of minutes. So thats probably the root of the problem, unrelated to PicoLisp. Though a bit of a hassle, since it takes away the huge advantage of PicoLisp's millisecond start-up time somehow, and shutting down a PicoLisp process and restart is not a prime option anymore if a couple of minutes waiting are involved. Thanks for the interesting link! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: kill without 'KILL does not work for PicoLisp processes
On Wed, 17 Jul 2013 16:14:11 +0700 Henrik Sarvell hsarv...@gmail.com wrote: When developing web apps I keep the code for the server and the rest separate and reload the rest on every request. No need for restarts at all that way. Unless you're actually fiddling with the actual server code, then it can't be helped I suppose... ..for such times (and for those times that you generally can't be so organised), there is the sledgehammer approach - SO_REUSEADDR http://stackoverflow.com/questions/775638/using-so-reuseaddr-what-happens-to-previously-open-socket -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: kill without 'KILL does not work for PicoLisp processes
On Wed, Jul 17, 2013 at 01:28:59PM +0300, Rowan Thorpe wrote: ..for such times (and for those times that you generally can't be so organised), there is the sledgehammer approach - SO_REUSEADDR Why sledgehammer approach? This is quite normal, as I see it. The PicoLisp network functions always set this socket option. ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: kill without 'KILL does not work for PicoLisp processes
On Wed, 17 Jul 2013 12:56:35 +0200 Alexander Burger a...@software-lab.de wrote: On Wed, Jul 17, 2013 at 01:28:59PM +0300, Rowan Thorpe wrote: ..for such times (and for those times that you generally can't be so organised), there is the sledgehammer approach - SO_REUSEADDR Why sledgehammer approach? This is quite normal, as I see it. The PicoLisp network functions always set this socket option. ♪♫ Alex :-D I didn't mean that SO_REUSEADDR *is* a sledgehammer. I just meant that when all else fails it can be used with a decidedly sledgehammer mentality i.e. I don't know what is killing my process and don't have time to find out right now, I just need it to start again and talk to the outside world ASAP... -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: kill without 'KILL does not work for PicoLisp processes
interesting idea ... Through the http server you can call any PL function, in that function you (load) stuff before doing what you need to do. From the above it kind of follows that I use a single bootstrap/entry/routing function, so I only need to do the loads there and nowhere else. On Wed, Jul 17, 2013 at 5:23 PM, Thorsten Jolitz tjol...@gmail.com wrote: Henrik Sarvell hsarv...@gmail.com writes: Hi Henrik, When developing web apps I keep the code for the server and the rest separate and reload the rest on every request. No need for restarts at all that way. interesting idea, not sure how you actually do that, but would make things smoother in the not so rare case of reaching a 'bad' state during development. Unless you're actually fiddling with the actual server code, then it can't be helped I suppose... I don't, so that would not be a problem. On Wed, Jul 17, 2013 at 3:33 PM, Thorsten Jolitz tjol...@gmail.com wrote: Rowan Thorpe ro...@rowanthorpe.com writes: On Wed, 17 Jul 2013 09:22:14 +0200 Thorsten Jolitz tjol...@gmail.com wrote: ..[snip].. I ran into this problem when experimenting with the web-framework and my app got into a bad state. When restarting then, PicoLisp tells me something like 'Port is already used', so I tried to kill the still running (*) PicoLisp processes with a simple 'kill PID', but to no avail. [* are they still running? 'ps' shows them with a '?', and I shutted them down on the command-line, so they shouldn't. But somehow they still block the port, and the more I shut down, the more are shown by 'ps'] ..[snip].. Sorry for asking the obvious question, but have you waited the couple of minutes needed for the kernel (depending on which kernel) to eventually clean orphaned ports itself? It *may* actually just be the port remaining open because the owning process didn't cleanly shut it?: as mentioned here http://superuser.com/a/127865 Not obvious for me, obviously, but definitely the right question - no I did not wait, and I did not know I have to wait a couple of minutes. So thats probably the root of the problem, unrelated to PicoLisp. Though a bit of a hassle, since it takes away the huge advantage of PicoLisp's millisecond start-up time somehow, and shutting down a PicoLisp process and restart is not a prime option anymore if a couple of minutes waiting are involved. Thanks for the interesting link! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe