The problem can (and indeed should) be fixed in the pass_persist script. Using select, the call will return with the fd set and the subsequent read will result in EOF (another read will result in EPIPE error). Using poll, the call will return with POLLHUP set meaning that the fd has been closed/disconnected and the subsequent read will also result in EOF. The pass_persist script should handle this case and shutdown cleanly. I think this is part of the protocol and should be added to the documentation in the snmpd.conf man page. It should also be ensured that the fd is not closed prematurely for any other reason. If a persistent script is used to avoid repeating a lengthy setup procedure (which I suppose is one fairly typical reason), this would defeat the purpose.
The remaining question is whether the daemon wants to protect itself from an erroneous script and in particular the blocking waitpid call. I agree that any script should behave correctly (and according to the protocol) and that there are numerous ways that an erroneous script could block/harm the daemon. You cannot cover all the cases, but I still think that the daemon should protect itself from this particular case as the blocking waitpid call is potentially dangerous. The pass-through script should be given a chance to shutdown cleanly but if it doesn't take that chance (in a reasonable amount of time), then it should be forcefully shutdown. But as already stated in the thread, the patch doesn't give the script enough of a chance as the time between closing the fd and the kill is too short and, for the same reason, it may also cause existing correctly written scripts to suffer data loss. I would prefer the solution using the callback (and handling the relevant corner cases).
------------------------------------------------------------------------- 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
_______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
