Menu

#1381 broken pipe cause snmptrapd to exit

traps
closed
nobody
apps (205)
5
2014-08-17
2005-06-14
Anonymous
No

If snmptrapd runs a traphandle and recive a SIGPIPE
(broken pipe) the daemon exits without an error.

<snip src="strace">
--- SIGCHLD (Child exited) ---
close(9) = 0
close(12) = 0
write(10, "hostname\nxxx.xxx.xxx.xxx\nS"..., 357) = -1
EPIPE (Broken pipe)
--- SIGPIPE (Broken pipe) ---
</snip>

You can reproduce this using /bin/true as traphandle
program.

There is no error in the logfile and all seems
completly OK, only that the snmptrapd is not runing any
more :-(

An error message and an runing snmptrapd seems for me
more reliable.

My email address is ak@ilk.net

net-snmp version: 5.1.2

Discussion

  • Thomas Anders

    Thomas Anders - 2005-06-24

    Logged In: YES
    user_id=848638

    This should be fixed in 5.1.3.pre1 and a patch has been
    posted on the mailinglists. It basically involves to ignore
    SIGPIPE.

     
  • Thomas Anders

    Thomas Anders - 2005-06-28

    Logged In: YES
    user_id=848638

    Can you please indicate whether 5.1.3.pre1 and/or the
    addition of "signal(SIGPIPE, SIG_IGN)" fixes your problem?
    We tend to think that this issue is already solved and the
    bug should be closed.

     
  • Nobody/Anonymous

    Logged In: NO

    I did an test on my FreeBSD box.

    $ snmptrapd -v

    NET-SNMP Version: 5.2.1
    Web: http://www.net-snmp.org/
    Email: net-snmp-coders@lists.sourceforge.net

    Strace on pid.

    pipe([11, 12]) = 11
    pipe([13, 14]) = 13
    fork() = 67259
    close(11) = 0
    --- SIGCHLD (Child exited) ---
    close(14) = 0
    write(12, "localhost\nUDP: [127.0.0.1]:54936"..., 290) = -1
    EPIPE (Broken pipe)
    --- SIGPIPE (Broken pipe) ---
    --- SIGPIPE (Broken pipe) ---
    $ ps aux|grep snmp
    $

    As trap I send:

    $ snmptrap -v 1 -c public localhost '' '' 3 0 ''

    Btw, an logentry would be nicer ;-)

     
  • Thomas Anders

    Thomas Anders - 2005-06-29

    Logged In: YES
    user_id=848638

    5.2.1 does *not* have the fix. You either need to use
    5.1.3.pre1 or CVS (they all have the fix) or add
    "signal(SIGPIPE, SIG_IGN)" around line 1128 in the 5.2.1
    source of apps/snmptrapd.c manually.

     
  • Thomas Anders

    Thomas Anders - 2005-06-29

    Logged In: YES
    user_id=848638

    As this is already fixed in CVS, I'm closing the bug.

     

Log in to post a comment.

MongoDB Logo MongoDB