[SNMP4J] Concurrency Exception

Marco Matchefts mmatchefts at cesura.com
Mon Feb 6 21:47:54 CET 2006


I have a multithreaded app.  I am currently getting a concurrency
exception inside the stack

in the Snmp::close function.  The stack trace is below.  One thread of
my app is closing the

Snmp::connection.  Another thread may have just sent a request.
Synchronization 

should prevent both from happing at the same time.  But I am getting the
following 

exception:

 

2006-02-06 14:37:02,225 WARN  DataCollectorTask sendRequest
failure:java.util.ConcurrentModificationException

2006-02-06 14:37:02,225 DEBUG DataCollectorTask sendRequest exception:

java.util.ConcurrentModificationException

        at java.util.Hashtable$Enumerator.next(Unknown Source)

        at org.snmp4j.Snmp.close(Snmp.java:430)

        at
com.vieo.management.snmp.SNMP4jSessionFactory$SessionAdapter.close(SNMP4
jSessionFactory.java:231)

        at
com.vieo.management.snmp.SNMP4jSessionFactory$SessionAdapter.send(SNMP4j
SessionFactory.java:266)

        at
com.vieo.management.snmp.DataCollectorTask.sendRequests(DataCollectorTas
k.java:169)

        at
com.vieo.management.snmp.DataCollectorTask.collectReadings(DataCollector
Task.java:122)

        at
com.vieo.management.snmp.DataCollectorTask.run(DataCollectorTask.java:30
0)

        at
com.vieo.util.TaskScheduler$TaskQueue$ScheduledTask.run(TaskScheduler.ja
va:1056)

        at com.vieo.util.ThreadPool$TaskRunner.run(ThreadPool.java:212)

        at java.lang.Thread.run(Unknown Source)

 

I see that the pendingRequests is just a plain Hashtable.  By chance is
there another thread

doing something on the pendingRequests hashtable while I am closing the
thread?

Any insight would be very helpful.  Thanks.

--Marco

 




More information about the SNMP4J mailing list