[SNMP4J] Java blocking on getting a random number from /dev/random

Adam Wells adam.wells at staff.pipenetworks.com
Wed Aug 3 05:22:15 CEST 2011


Hi All,

We have just resolved a knotty problem that we discovered when using SNMP4J
­ I am posting this in case it is useful to others.

SNMP4J uses random numbers in the security package.  When running on Ubuntu,
we experienced long (40 seconds) delays prior to the first snmp request
being sent.  Subsequent requests were fine, and were sent immediately.

The problem is that Java uses /dev/random on Ubuntu, which is secure, but
takes a long time to get going.  We changed /dev/random to be configured
like /dev/urandom so that it would not block ­ after that, happy days.

Solution taken from:
http://www.springone2gx.com/blog/pratik_patel/2010/01/solution_futex_wait_ha
ngs_java_on_linux__ubuntu_in_vmware_or_virtual_box

Alternate solution:
http://www.itonguard.com/20090313/weblogic-starts-slow/

Cheers,

Adam



More information about the SNMP4J mailing list