[SNMP4J] IllegalStateException in Snmp.send()
Alberto
alberto_mascheroni at fastwebnet.it
Wed Dec 13 16:38:28 CET 2006
Hello,
I refer to the correction provided in v1.7.1 and described by Frank in email
below.
Since I got the same problem in my project, I downloaded the SNMP4J version
1.7.5 and reproduced the error with log4j logs enabled.
Here the result (just reported the PduHandle with the problem, but if you need
I have the complete logs):
13/12/2006 14:30:30:131 DEBUG [pool-10-thread-22] [Log4jLogAdapter.debug] New
pending request with handle PduHandle[1826954335]
...
13/12/2006 14:30:45:579 DEBUG [Timer-15] [Log4jLogAdapter.debug] Running
pending request (3 left) with handle: PduHandle[1826954335]
...
13/12/2006 14:31:00:587 DEBUG [Timer-15] [Log4jLogAdapter.debug] Running
pending request (2 left) with handle: PduHandle[1826954335]
...
13/12/2006 14:31:00:589 DEBUG [SNMPDriverDispatchPool.2] [Log4jLogAdapter.
debug] Looking up pending request with handle PduHandle[1826954335]
...
13/12/2006 14:31:00:591 ERROR [Timer-15] [Log4jLogAdapter.error] Failed to
process pending request PduHandle[1826954335] because Task already scheduled or
cancelled
java.lang.IllegalStateException: Task already scheduled or cancelled
at java.util.Timer.sched(Timer.java:358)
at java.util.Timer.schedule(Timer.java:170)
at org.snmp4j.Snmp$PendingRequest.run(Snmp.java:1426)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
...
13/12/2006 14:31:00:590 DEBUG [pool-10-thread-22] [Log4jLogAdapter.debug]
Removed pending request with handle: PduHandle[1826954335]
...
It seems there is a relation between the time the Timer-15 is checking the
handle for the second time (14:31:00:587) and the time the answer comes (14:31:
00:589). They are really very closed one to the other.
Maybe a synchronization problem among threads?
Of course, after Timer-15 thread dies, no Snmp primitive to the agent is
possible anymore and my application has to be restarted.
Can you help, please?
Regards,
Alberto
Frank wrote:
> Hi Fabian,
>
> We can catch only a RuntimeException and rethrow it. I have
> changed the code as follows for v1.7.1:
>
> /**
> * run
> */
> public synchronized void run() {
> try {
> if ((!finished) && (retryCount > 0)) {
> ...
> }
> }
> catch (RuntimeException ex) {
> logger.error("Failed to process pending request "+key+
> " because"+ex.getMessage(), ex);
> throw ex;
> }
>
> Best regards,
> Frank
>
--------------------
Alberto Mascheroni
Mob. +39-333-6314222
More information about the SNMP4J
mailing list