close function -> RE: [SNMP4J] SNMP4J 1.7 and SNMP4J-Agent 1.0beta1 Released
Kevin Stretch
kevin.stretch at sjrb.ca
Wed Apr 12 17:17:58 CEST 2006
Here's the debug dump from the SNMP4J code.
I'll look at a few other things but if you have any ideas let me know.
snmp4j/src/org/snmp4j/Snmp.java
public void close() throws IOException {^M
System.out.println ("CLOSE1\n");
for (Iterator it =
messageDispatcher.getTransportMappings().iterator();^M
it.hasNext(); ) {^M
System.out.println ("CLOSE2\n");
((TransportMapping) it.next()).close();^M
}^M
System.out.println ("CLOSE3\n");
[root at kstretch lib]# !java
java -cp ./SNMP4J.jar:./ XmlSnmp4j 1239
CLOSE1
CLOSE2
...<no response>...
<ctrl-C>
[root at kstretch lib]# vi ../snmp4j/
-----Original Message-----
From: Kevin Stretch
Sent: Tuesday, April 11, 2006 5:08 PM
To: 'Frank Fock'
Cc: SNMP4J
Subject: RE: close function -> RE: [SNMP4J] SNMP4J 1.7 and SNMP4J-Agent
1.0beta1 Released
Sorry I should have caught that.
Here's more of the code that will explain what it's doing.
Note its also threaded (if that makes a difference).
public class SNMPData {
Snmp snmp = new Snmp();
}
public void close () throws IOException {
System.out.println ("aaa\n");
if (snmp != null) {
System.out.println ("bbb\n");
snmp.close();
System.out.println ("ccc\n");
}
}
OUTPUT:
XXXXXXXclose
aaa
bbb
....no response....
<CTRL-C>
[root at kstretch lib]#
-Kevin
-----Original Message-----
From: Frank Fock [mailto:fock at agentpp.com]
Sent: Tuesday, April 11, 2006 5:00 PM
To: Kevin Stretch
Cc: SNMP4J
Subject: Re: close function -> RE: [SNMP4J] SNMP4J 1.7 and SNMP4J-Agent
1.0beta1 Released
Hi Kevin,
SNMPData is not a class of SNMP4J, maybe its close()
method does something special?
The possible NPE was in fact a race condition in the
close method.
Best regards,
Frank
Kevin Stretch wrote:
> Can I get a more indepth explanation of this change?
>
> * Fixed: Possible NullPointerException when closing Snmp.
>
> I tried upgrading my program to the new package and it now hangs when
> calling close:
>
> SNMPData SnmpData;
> ...
> SnmpData.close();
>
> I'll get some debug lines going in the SNMP4J code tomorrow and see
what
> I can dig up.
>
> I was hoping this release might fix a bug where ~1/1000 transactions
> always leaves ResponseEvent.getResponse() as NULL for one specific
> device even if the device is pollable via other means. A TCPDUMP
> reveals the program didn't send out a request. A restart of the
program
> fixes the issue.
>
> -Kevin
>
>
>
>
>
> -----Original Message-----
> From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org]
On
> Behalf Of Frank Fock
> Sent: Monday, April 10, 2006 6:54 PM
> To: SNMP4J
> Subject: [SNMP4J] SNMP4J 1.7 and SNMP4J-Agent 1.0beta1 Released
>
> Dear SNMP4J-Users,
>
> SNMP4J v1.7 and SNMP4J-Agent 1.0beta1 have been released today
> and can be downloaded from http://www.snmp4j.org
>
> SNMP4J-Agent is still not documented as it should be, however
> its code base should now be reasonable stable. Until v1.0 can
> be finally released, TODOs in the code have to implemented,
> everything thoroughly tested, and possible bugs removed (reports
> are appreciated!). The managed object interface is now so stable
> that AgenPro 2.5 with new and enhanced templates for SNMP4J will
> be released in about three weeks.
>
> RELEASE NOTES
>
> CHANGES SNMP4J v1.7 SINCE v1.6e:
> * Improved: Logging interface enhanced.
> * Added: Variable.toInt() and Variable.toLong() to reduce
> casting when converting to native integer or long values.
> * Fixed: OID.mask.
> * Added: When PDUv1 decodes a Counter64 object, a
> MessageException is thrown.
> * Added: OID.nextPeer(), OID.successor(),
> and OID.predecessor().
> * Fixed: ThreadPool.stop() blocked.
> * Fixed: Additional retries with sync requests when first
> try failed and second (or second to last) succeeded.
> * Fixed: Possible NullPointerException when closing Snmp.
> * Improved: Closing UDP default transport mapping first
> disconnects socket before closing it.
> * Fixed: Possible ConcurrentModificationException when using
> List returned by sync TableUtils.getTable(..).
> * Added: OctetString.fromByteArray to create an OctetString
> from a byte array.
> * Improved: OID.successor() to build correct successor for
> 128 subidentifier OIDs.
> * Added: OID.min(OID a, OID b) and OID.max(OID a, OID b)
> * Fixed: Handling of remote disconnect of TCP transport
> mapping.
> * Added: ConnectionOrientedTransportMapping interface and
> TransportStateListener event listener.
> * Added: Variable.getSyntaxString().
> * Fixed: Bug in Snmp.send(PDU pdu, Target target,
> TransportMapping transport) which did not propagate the
> transport mapping.
> * Added: UsignedInteger32(int) and UsignedInteger32(byte)
> constructor.
> * Fixed: Set SnmpMessageLengthDecoder as default for
> DefaultTCPTransportMapping.
> * Added sysOREntry OID constant in SnmpConstants.
>
>
> CHANGES SNMP4J-AGENT v1.0-beta1 SINCE v1.0-alpha2:
>
> * Added: SNMP-COMMUNITY-MIB support for coexistence.
> * Added: ProxyForwarder implementation including
> SNMP-PROXY-MIB.
> * Added: SNMP4J-CONFIG-MIB and SNMP4J-LOG-MIB
> implementations.
> * Fixed: A couple of bugs regarding notification
> originator and filtering.
> * Improved: Table relationships.
> * Added: MOFatory, MOTableModelEvent, etc.
> * Added: TextualConvention interface and related
> objects in org.snmp4j.agent.mo.snmp.tc.
> * Improved: Value constraint handling through classes
> in org.snmp4j.agent.mo.snmp.smi.
> * Added: Some more TCs like TruthValue, TimeStamp,
> etc.
> * Added: IndexGenerator to create unique index values.
> * And many more changes...
>
>
> Regards,
> Frank Fock
>
>
>
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list