Re: snmptrapd cpu usage on solaris when disconnected from pty.

"Jayson Robinson" <[email protected]>
Newsgroups gmane.network.net-snmp.devel,gmane.network.net-snmp.user
Message-ID <[email protected]>
Tom,

Thanks for the quick reply.   I just did a double check on the binaries and 
the source code.  It is 5.3 and not 5.3.0.1.  I have also run truss on the 
trap daemon and here are the results.  The parent snmptrapd does not account 
for any time on the cpu but the one it forks runs up a lot of time.

As you can see from the following (in 90 seconds):
    root  4238  4235 38 09:21:17 pts/4    1:29 truss -f -o /tmp/truss.out 
/opt/net-snmp/sbin/snmptrapd -C -c /opt/net-snmp/sha
    root  4235  3339  0 09:21:17 pts/4    0:00 truss -f -o /tmp/truss.out 
/opt/net-snmp/sbin/snmptrapd -C -c /opt/net-snmp/sha

The output from a tail -f on the truss.out file that truss created shows the 
following (the full truss output was huge at this point but I think you can 
see whats happening with this snippet when compared to the snmptrapd with 
the -f option:
4237:   poll(0xFFBFF730, 6, 5000)                       = 3
4237:   poll(0xFFBFF730, 6, 5000)                       = 3
4237:   poll(0xFFBFF730, 6, 5000)                       = 3
4237:   poll(0xFFBFF730, 6, 5000)                       = 3
4237:   poll(0xFFBFF730, 6, 5000)                       = 3
4237:   poll(0xFFBFF730, 6, 5000)                       = 3
4237:   poll(0xFFBFF730, 6, 5000)                       = 3
4237:   poll(0xFFBFF730, 6, 5000)                       = 3
4237:   poll(0xFFBFF730, 6, 5000)                       = 3


That output is repeating very fast and in 2 minutes worth of operaiton we 
have generated 5185153 lines in that file.  That file is growing by 
approximately 1.5 million lines per minute now.  I have been watching the 
file and there is nothing else coming through the output.

Now when I truss the output including the -f option to not fork the 
snmptrapd process I get the following at a rate of  27 messages per minute - 
(HUGE DIFFERENCE):
5065:   bind(7, 0xFFBFF6E8, 16, 3)                      = 0
5065:   poll(0xFFBFF730, 6, 5000)       (sleeping...)
5065:   poll(0xFFBFF730, 6, 5000)                       = 0
5065:   poll(0xFFBFF730, 3, 5000)       (sleeping...)
5065:   poll(0xFFBFF730, 3, 5000)                       = 0
5065:   poll(0xFFBFF730, 3, 4986)       (sleeping...)
5065:   poll(0xFFBFF730, 3, 4986)                       = 0
5065:   so_socket(PF_UNIX, SOCK_STREAM, 0, "", 1)       = 9
5065:   connect(9, 0xFFBFEF50, 110, 1)                  Err#2 ENOENT
5065:   close(9)                                        = 0
5065:   poll(0xFFBFF730, 3, 5000)       (sleeping...)
5065:   poll(0xFFBFF730, 3, 5000)                       = 0
5065:   poll(0xFFBFF730, 3, 5000)       (sleeping...)
5065:   poll(0xFFBFF730, 3, 5000)                       = 0
5065:   poll(0xFFBFF730, 3, 4980)       (sleeping...)
5065:   poll(0xFFBFF730, 3, 4980)                       = 0
5065:   so_socket(PF_UNIX, SOCK_STREAM, 0, "", 1)       = 9
5065:   connect(9, 0xFFBFEF50, 110, 1)                  Err#2 ENOENT
5065:   close(9)                                        = 0

and that just repeats over and over again like I would expect a daemon to.

Anyone got any idea on this?

Jayson Robinson

>From: Thomas Anders <[email protected]>
>To: [email protected]
>Subject: Re: snmptrapd cpu usage on solaris when disconnected from pty.
>Date: Tue, 11 Apr 2006 22:37:44 +0200
>
>Jayson Robinson wrote:
>>I'm running snmptrapd 5.3.01 on a solaris 9 box.  When I run from the 
>>command line and use the -f option I see less then 1% cpu usage.  Whenever 
>>I call the snmptrapd from the startup script (and it's using the same 
>>exact options) cpu goes way up
>
>To see where it spends the cycles, can you run it either under truss (with 
>the appropriate option(s) to output time deltas) or build a profiled binary 
>for use with gprof?
>
>>NET-SNMP version 5.3
>
>Didn't you say you're running 5.3.0.1, not 5.3?
>
>
>+Thomas
>
>--
>Thomas Anders (thomas.anders at blue-cable.de)
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>that extends applications into web and mobile media. Attend the live 
>webcast
>and join the prime developer group breaking into this new coding territory!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>_______________________________________________
>Net-snmp-users mailing list
>[email protected]
>Please see the following page to unsubscribe or change other options:
>https://lists.sourceforge.net/lists/listinfo/net-snmp-users

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.