[SNMP4J] Notification issues

Frank Fock fock at agentpp.com
Tue Feb 21 00:25:49 CET 2006


Hello Matthias,

Thanks for reporting that bug. I have fixed it
by enclosing all accessing of the snmpTargetAddrTagIndex
instances into a synchronized(snmpTargetAddrTagIndex)
like shown for example by

   public Collection getTargetAddrRowsForTag(String tag) {
     Collection l = (Collection)snmpTargetAddrTagIndex.get(tag);
     if (l == null) {
       return Collections.EMPTY_SET;
     }
     else {
       synchronized (l) {
         l = new ArrayList(l);
       }
     }
     return l;
   }

This should avoid these exceptions. But that's probably
not the only fix necessary to make this notification
sending really thread safe... I will have to check the
code once again before the beta release.

Best regards,
Frank

Matthias Wiesmann wrote:
> Hello everybody, Frank,
> 
> I think I have found two other issues in the notification mechanism.
> 
> First the data structures seems unable to handle concurrent
> modification of the notification data structures whiles a notification
> is sent.
> 
> I got the following exception, when trying to remove a notification
> entry while notifications are sent at a high rate.
> 
> java.util.ConcurrentModificationException
> 	at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1031)
> 	at java.util.TreeMap$ValueIterator.next(TreeMap.java:1064)
> 	at org.snmp4j.agent.mo.snmp.NotificationOriginatorImpl.notify(NotificationOriginatorImpl.java:108)
> 	at jp.ac.jaist.snmpd.FDAgent$AgentHub.notify(FDAgent.java:64)
> 
> Second, it seems that if you create a notification entry, disable it
> (by changing its status) and enable it again, it does not work.
> 
> Cheers.
> 
> Matthias
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list