Keating:ProcedeLog: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
No edit summary
No edit summary
Line 9: Line 9:
| d
| d
| 08/13/05
| 08/13/05
| Communication with CHARMM is now done with a pipe. So when CHARMM dies for some reason, the OS sends a SIGCHLD signal to the perl wrapper and the process is not removed from the process table until the parent examines it (traps the SIGCHLD signal) - this is how zombies are made. To avoid zombies I used to set $SIG{CHLD} to "IGNORE" just before printing to CHARMM in CHARMM::send such that if the child process died as a result of the print, the SIGCHLD signal would be ignored and the child process would be removed from the proccess table (and upon the next print or closing of the pipe the fact that the child had died would be discovered). At the end of CHARMM::send $SIG{CHLD} was set to "". This only worked sometime and I think this is because CHARMM would not always die immediately after a bad print statement (it maye take some time for the buffer to be flushed or the command to be processed). So if CHARMM dies when $SIG{CHLD} is "", the signal does not get taken care of and so a zombie is made. Now, I though that if in this condition you set $SIG{CHLD} to ignore, the undelivered signal should now be ignored and the zombie be cleared, but aparently this is not so (if there is no handler at the time of the signal, it does not matter if you make a handler later - the signal will not be processed). To deal with this I simply made a real child reaper (GENERAL::REAPER) according to recipe 16.9 from the Perl Cookbook and set $SIG{CHLD} to its reference in CHARMM::new. Additionally, before doing this I save the previous SIGCHLD handler in $self->{_prev_reaper} (if it is defined) and in CHARMM::DESTROY I restore the handler back to it (again, if it exists).
| Communication with CHARMM is now done with a pipe. So when CHARMM dies for some reason, the OS sends a SIGCHLD signal to the perl wrapper and the process is not removed from the process table until the parent examines it with waitpid or ignores the SIGCHLD signal - this is how zombies are made. To avoid zombies I used to set $SIG{CHLD} to "IGNORE" just before printing to CHARMM in CHARMM::send such that if the child process died as a result of the print, the SIGCHLD signal would be ignored and the child process would be removed from the proccess table (and upon the next print or closing of the pipe the fact that the child had died would be discovered). At the end of CHARMM::send $SIG{CHLD} was set to "". This only worked sometime and I think this is because CHARMM would not always die immediately after a bad print statement (it maye take some time for the buffer to be flushed or the command to be processed). So if CHARMM dies when $SIG{CHLD} is "", the signal does not get taken care of and so a zombie is made. Now, I though that if in this condition you set $SIG{CHLD} to ignore, the undelivered signal should now be ignored and the zombie be cleared, but aparently this is not so (if there is no handler at the time of the signal, it does not matter if you make a handler later - the signal will not be processed). To deal with this I simply made a real child reaper (GENERAL::REAPER) according to recipe 16.9 from the Perl Cookbook and set $SIG{CHLD} to its reference in CHARMM::new. Additionally, before doing this I save the previous SIGCHLD handler in $self->{_prev_reaper} (if it is defined) and in CHARMM::DESTROY I restore the handler back to it (again, if it exists).
| Anything using CHARMM. This change should not affect anything on the user's side.
| Anything using CHARMM. This change should not affect anything on the user's side.
|-
|-

Revision as of 07:30, 16 August 2005

Here the ongoing changes to version d of ProCEDe will be documented. Users are encouranged to read through this and this and ask questions and make suggestions.


Module/Script Ver Date Nature of Change Affected scripts/modules
CHARMM.pm d 08/13/05 Communication with CHARMM is now done with a pipe. So when CHARMM dies for some reason, the OS sends a SIGCHLD signal to the perl wrapper and the process is not removed from the process table until the parent examines it with waitpid or ignores the SIGCHLD signal - this is how zombies are made. To avoid zombies I used to set $SIG{CHLD} to "IGNORE" just before printing to CHARMM in CHARMM::send such that if the child process died as a result of the print, the SIGCHLD signal would be ignored and the child process would be removed from the proccess table (and upon the next print or closing of the pipe the fact that the child had died would be discovered). At the end of CHARMM::send $SIG{CHLD} was set to "". This only worked sometime and I think this is because CHARMM would not always die immediately after a bad print statement (it maye take some time for the buffer to be flushed or the command to be processed). So if CHARMM dies when $SIG{CHLD} is "", the signal does not get taken care of and so a zombie is made. Now, I though that if in this condition you set $SIG{CHLD} to ignore, the undelivered signal should now be ignored and the zombie be cleared, but aparently this is not so (if there is no handler at the time of the signal, it does not matter if you make a handler later - the signal will not be processed). To deal with this I simply made a real child reaper (GENERAL::REAPER) according to recipe 16.9 from the Perl Cookbook and set $SIG{CHLD} to its reference in CHARMM::new. Additionally, before doing this I save the previous SIGCHLD handler in $self->{_prev_reaper} (if it is defined) and in CHARMM::DESTROY I restore the handler back to it (again, if it exists). Anything using CHARMM. This change should not affect anything on the user's side.
naccess d 08/10/05 I changed the naccess shell script such that error and warning messages are printed to STDERR. It used to be printed to STDOUT and this was an issue since ENERGY::getAtomicSA executed naccess with "> /dev/null" meaning that STDOUT was ignored. So if there was an error, it would never be seen. Printing errors and warnings to STDERR is in general better than having to examine STDOUT after every call. Anything calling naccess (ENERGY::getAtomicSA)
CHARMM.pm d 08/10/05 Now that communication with CHARMM is interactive, every write MUST be followed by a proper title ("* something\n*\n"). Otherwise, CHARMM tries to read the title and when it does not find one, it does BACKSPACE on the input stream (really stupid, but that is how it's implemented), which works for regular files, but may fail for pipes. I looked through all occurances of writes in CHARMM.pm and made sure that a proper title follows. CHARMM.pm and everything depending on it.