JMX/transport connector exception due to lack of entropy in randomness device
-----------------------------------------------------------------------------
Key: AMQ-2272
URL: https://issues.apache.org/activemq/browse/AMQ-2272
Project: ActiveMQ
Issue Type: Bug
Components: JMX
Affects Versions: 5.2.0
Environment: Linux / User-Mode-Linux virtualisation
Reporter: Josef Spillner
[This report is probably not describing a bug in ActiveMQ itself, but it shows
up when using ActiveMQ and prevents it from functioning correctly, this is why
I'm starting to report it at this level of the stack. Depending on feedback, it
can be propagated further down the stack.]
When running ActiveMQ on User-Mode-Linux, some of its parts (notably the
transport connector registration with JMX) fails because some random id cannot
be created due to lack of entropy in /dev/random. As opposed to /dev/urandom,
/dev/random is known to not have a lot of entropy and to block any read access
until the pool is filled up again. This is a known, documented and correct
behaviour. For some reason, it seems that the Sun implementation's seed
generator accesses this device in non-blocking mode and fails to read random
numbers. Or maybe it is instrumented to do so from the code which uses it.
Among other issues, it means that the listener on port 61616 is running while
the Stomp listener on port 61613 won't be active. It would be nice to have
someone with knowledge of the stack, including the use of Spring, to see whose
fault causes this issue.
This is the full backtrace:
ERROR: java.lang.Exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class
path resource [activemq.xml]: Invocation of init method failed; nested
exception is java.io.IOException: Transport Connector could not be registered
in JMX: URLSeedGenerator file:/dev/random reached end of file
java.lang.Exception: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0'
defined in class path resource [activemq.xml]: Invocation of init method
failed; nested exception is java.io.IOException: Transport Connector could not
be registered in JMX: URLSeedGenerator file:/dev/random reached end of file
at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:99)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.activemq.console.Main.runTaskClass(Main.java:225)
at org.apache.activemq.console.Main.main(Main.java:106)
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0'
defined in class path resource [activemq.xml]: Invocation of init method
failed; nested exception is java.io.IOException: Transport Connector could not
be registered in JMX: URLSeedGenerator file:/dev/random reached end of file
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
at
org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:96)at
org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:52)
at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
at
org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
at
org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:115)
at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
... 10 more
Caused by: java.io.IOException: Transport Connector could not be registered in
JMX: URLSeedGenerator file:/dev/random reached end of file
at
org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
at
org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1434)
at
org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:1893)
at
org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:1844)
at
org.apache.activemq.broker.BrokerService.start(BrokerService.java:480)
at
org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:52)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
... 30 more
Caused by: java.lang.InternalError: URLSeedGenerator file:/dev/random reached
end of file
at
sun.security.provider.SeedGenerator$URLSeedGenerator.getSeedByte(SeedGenerator.java:478)
at
sun.security.provider.SeedGenerator.getSeedBytes(SeedGenerator.java:140)
at
sun.security.provider.SeedGenerator.generateSeed(SeedGenerator.java:135)
at
sun.security.provider.SecureRandom.engineGenerateSeed(SecureRandom.java:131)
at
sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:188)
at java.security.SecureRandom.nextBytes(SecureRandom.java:450)
at java.security.SecureRandom.next(SecureRandom.java:472)
at java.util.Random.nextInt(Random.java:204)
at sun.security.ssl.SSLContextImpl.engineInit(SSLContextImpl.java:102)
at javax.net.ssl.SSLContext.init(SSLContext.java:265)
at
org.apache.activemq.broker.SslContext.getSSLContext(SslContext.java:126)
at
org.apache.activemq.transport.tcp.SslTransportFactory.createServerSocketFactory(SslTransportFactory.java:155)
at
org.apache.activemq.transport.tcp.SslTransportFactory.doBind(SslTransportFactory.java:76)
at
org.apache.activemq.transport.TransportFactory.bind(TransportFactory.java:131)
at
org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:293)
at
org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:135)
at
org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:98)
at
org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:1428)
... 36 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.