Closed jmbredal closed 7 years ago
(by mbrekkevold) Macrom, could you please try the attached patch? I'm not quite sure how to reproduce the error you're seeing, but this change should the actual error message and log it.
(by a-l-prois) Patch applied, and here is output from logfile : [2010-09-24 11:39:30,128] [DEBUG] [pid=29771 nav.snmptrapd] Trying to load handlermodules [2010-09-24 11:39:30,975] [DEBUG] [pid=29771 nav.snmptrapd] Going into daemon mode... [2010-09-24 11:39:30,981] [DEBUG] [pid=29773 nav.daemon] Daemon started with pid 29773. [2010-09-24 11:39:30,983] [DEBUG] [pid=29773 nav.logs] Reopening /usr/local/nav/var/log/snmptrapd.log [2010-09-24 11:39:30,984] [DEBUG] [pid=29773 nav.logs] Reopened /usr/local/nav/var/log/snmptrapd.log [2010-09-24 11:39:30,985] [DEBUG] [pid=29773 nav.logs] Reopening /usr/local/nav/var/log/snmptraps.log [2010-09-24 11:39:30,985] [DEBUG] [pid=29773 nav.logs] Reopened /usr/local/nav/var/log/snmptraps.log [2010-09-24 11:39:30,986] [DEBUG] [pid=29773 nav.snmptrapd] Daemonization complete; reopened log files. [2010-09-24 11:39:30,988] [DEBUG] [pid=29772 nav.daemon] Second parent exiting. Daemon has pid 29773. [2010-09-24 11:39:31,006] [DEBUG] [pid=29773 nav.db] Invalid connection object (('usit_nav', 'usit_nav_user')), age=1.11800599098 [2010-09-24 11:39:31,010] [DEBUG] [pid=29771 nav.daemon] First parent exiting. Second has pid 29772. [2010-09-24 11:39:31,252] [DEBUG] [pid=29773 nav.db] Opened a new database connection, scriptName=default, dbname=usit_nav, user=usit_nav_user [2010-09-24 11:39:31,253] [DEBUG] [pid=29773 nav.snmptrapd] Adding signal handler for reopening log files on SIGHUP. [2010-09-24 11:39:31,253] [INFO] [pid=29773 nav.snmptrapd] Snmptrapd started, listening on port 162 [2010-09-24 12:06:30,639] [WARNING] [pid=29773 nav.snmptrapd] SIGTERM received: Shutting down. [2010-09-24 12:06:30,639] [ERROR] [pid=29773 nav.snmptrapd.agent_se] Unknown exception while receiving snmp trap Traceback (most recent call last): File "/usr/local/nav/lib/python/nav/snmptrapd/agent_se.py", line 106, in listen (request, src) = self._agent.receive() File "/usr/lib/python2.4/site-packages/pysnmp/mapping/udp/role.py", line 361, in receive r, w, x = select.select(r, w, x, self.timeout) File "/usr/local/nav/bin/snmptrapd.py", line 290, in signal_handler sys.exit(0) SystemExit: 0
(by mbrekkevold) So the error is that it logs an error and shuts down when you tell it to shut down?
(by mbrekkevold) This can only be reproduced under Python 2.4, as Python 2.5 changed the parent of the SystemExit exception.
fix is here: http://metanav.uninett.no/hg/series/3.6.x/rev/b95db75f5c71
Translated changeset references: http://metanav.uninett.no/hg/series/3.6.x/rev/b95db75f5c71: e8f9515fdb4e52c5af46e424446b9d87f81e3c95
NAV : 3.6.0b6 OS : RHEL 5.5
First startup of snmptrapd after upgrading from 3.6.0b5 to b6 : [2010-09-24 08:33:26,360] [DEBUG] [pid=5494 nav.snmptrapd] Trying to load handlermodules [2010-09-24 08:33:26,789] [DEBUG] [pid=5494 nav.snmptrapd] Going into daemon mode... [2010-09-24 08:33:26,792] [DEBUG] [pid=5494 nav.daemon] First parent exiting. Second has pid 5495. [2010-09-24 08:33:26,794] [DEBUG] [pid=5496 nav.daemon] Daemon started with pid 5496. [2010-09-24 08:33:26,797] [DEBUG] [pid=5496 nav.logs] Reopening /usr/local/nav/var/log/snmptrapd.log [2010-09-24 08:33:26,798] [DEBUG] [pid=5496 nav.logs] Reopened /usr/local/nav/var/log/snmptrapd.log [2010-09-24 08:33:26,798] [DEBUG] [pid=5496 nav.logs] Reopening /usr/local/nav/var/log/snmptraps.log [2010-09-24 08:33:26,799] [DEBUG] [pid=5496 nav.logs] Reopened /usr/local/nav/var/log/snmptraps.log [2010-09-24 08:33:26,799] [DEBUG] [pid=5496 nav.snmptrapd] Daemonization complete; reopened log files. [2010-09-24 08:33:26,802] [DEBUG] [pid=5496 nav.db] Invalid connection object (('nav', 'nav_user')), age=0.564680099487 [2010-09-24 08:33:26,805] [DEBUG] [pid=5495 nav.daemon] Second parent exiting. Daemon has pid 5496. [2010-09-24 08:33:26,917] [DEBUG] [pid=5496 nav.db] Opened a new database connection, scriptName=default, dbname=nav, user=nav_user [2010-09-24 08:33:26,917] [DEBUG] [pid=5496 nav.snmptrapd] Adding signal handler for reopening log files on SIGHUP. [2010-09-24 08:33:26,918] [INFO] [pid=5496 nav.snmptrapd] Snmptrapd started, listening on port 162 [2010-09-24 08:33:54,180] [WARNING] [pid=5496 nav.snmptrapd] SIGTERM received: Shutting down. [2010-09-24 08:33:54,181] [CRITICAL] [pid=5496 nav.snmptrapd] Fatal exception ocurred Traceback (most recent call last): File "/usr/local/nav/bin/snmptrapd.py", line 184, in main server.listen(community, trapHandler) File "/usr/local/nav/lib/python/nav/snmptrapd/agent_se.py", line 112, in listen "packet from %r, ignoring trap", src) UnboundLocalError: local variable 'src' referenced before assignment [2010-09-24 08:33:54,183] [DEBUG] [pid=5496 nav.daemon] Daemon is exiting. Cleaning up... [2010-09-24 08:33:54,183] [DEBUG] [pid=5496 nav.daemon] pidfile (/usr/local/nav/var/run/snmptrapd.pid) removed.
Imported from Launchpad using lp2gh.