Bluehost.com Web Hosting $6.95

5.2.1 Trap Handler causes snmptrapd to exit from broken pipe

This is a discussion on 5.2.1 Trap Handler causes snmptrapd to exit from broken pipe within the SNMP Users forums, part of the Networking and Network Related category; Hello List, I hope this is the right spot to discuss this. My apologies if it isn't or has ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-04-2005
Michael Higgins
 
Posts: n/a
Default 5.2.1 Trap Handler causes snmptrapd to exit from broken pipe

Hello List,

I hope this is the right spot to discuss this. My apologies if it isn't
or has been addressed already. I did some searches in the archive and
found other people reporting broken pipe errors but no resolution.

Using a simple setup as described in
http://www.net-snmp.org/tutorial/tut.../snmptrap.html, when
a trap is received, the snmptrapd process fails from a broken pipe. I
then use the same setup with 5.0.9 and everything functions as designed.

I did a little digging and it looks like the problem is in
agent/mibgroup/utilities/execute.c in run_exec_command(). I don't know
a whole lot about how this is architected, but it appears that two
threads are responsible for making this happen. One gets the trap
handler process running and the other writes to its stdin and waits for
any output.

What I see happening is the thread that is initiating the trap handler
does some manipulation of file descriptors, closing the standard ones
and redirecting them to pipes. When it does a close(2), this function
never returns. (Is this stderr?) In the meantime, the other thread
marches ahead and attempts to write to the pipe. This is where the
broken pipe happens and the process terminates. I tracked this down by
simply adding more DEBUGMSGTL calls.

5.0.9 uses a radically different technique that I haven't looked into yet.

Unfortunately I don't know enough about this file descriptor
manipulation to attempt a fix. If I can get some pointers, perhaps I
can find a fix. I didn't see it bugged either. Should it be?

Details:

NetSnmp 5.2.1
OS: Fedora Core 2 2.6.10-1.770_FC2 #1 Sat Feb 26 21:40:22 EST 2005 i686
i686 i386 GNU/Linux

snmptrapd.conf:

traphandle default "/src/snmp/traps.sh" default

traps.sh:

#!/bin/sh

read host
read ip
vars=

while read oid val
do
if [ "$vars" = "" ]http://www.net-snmp.org/tutorial/tutorial-5/commands/snmptrap.html
then
vars="$oid = $val"
else
vars="$vars, $oid = $val"
fi
done

echo trap: $1 $host $ip $vars







-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/...net-snmp-users
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:04 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0