Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to send an empty message results in an error #24

Closed
bezmax opened this issue Jun 9, 2017 · 3 comments
Closed

Trying to send an empty message results in an error #24

bezmax opened this issue Jun 9, 2017 · 3 comments
Assignees
Milestone

Comments

@bezmax
Copy link

bezmax commented Jun 9, 2017

Sending an empty message results in this error:

org.springframework.jms.MessageEOFException: Cannot read all of non-RMQ Message body.; nested exception is javax.jms.MessageEOFException: Cannot read all of non-RMQ Message body.
	at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:294)
	at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:487)
	at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:484)
	at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:440)
	at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:394)
	at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:157)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
	at org.apache.camel.component.netty4.handlers.ServerChannelHandler.processAsynchronously(ServerChannelHandler.java:138)
	at org.apache.camel.component.netty4.handlers.ServerChannelHandler.channelRead0(ServerChannelHandler.java:109)
	at org.apache.camel.component.netty4.http.handlers.HttpServerChannelHandler.channelRead0(HttpServerChannelHandler.java:213)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at org.apache.camel.component.netty4.http.handlers.HttpServerMultiplexChannelHandler.channelRead0(HttpServerMultiplexChannelHandler.java:113)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:38)
	at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:353)
	at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
	at java.lang.Thread.run(Thread.java:745)
Caused by: javax.jms.MessageEOFException: Cannot read all of non-RMQ Message body.
	at com.rabbitmq.jms.client.message.RMQBytesMessage.recreate(RMQBytesMessage.java:561)
	at com.rabbitmq.jms.client.RMQMessage.normalise(RMQMessage.java:1356)
	at com.rabbitmq.jms.client.RMQMessageProducer.internalSend(RMQMessageProducer.java:234)
	at com.rabbitmq.jms.client.RMQMessageProducer.send(RMQMessageProducer.java:189)
	at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:626)
	at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSend(JmsConfiguration.java:592)
	at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:531)
	at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:473)
	at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$1.doInJms(JmsConfiguration.java:487)
	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:484)
	... 23 more

It seems that the problem is in RMQBytesMessage#recreate(BytesMessage), line if (bodySize != msg.readBytes(byteArray, bodySize)). If the stream is empty, readBytes returns -1, which corresponds to bodySize being 0. However with the current straightforward comparison -1 and 0 are not equal.

@michaelklishin
Copy link
Member

Thank you for the full trace and the initial investigation.

@siryc
Copy link

siryc commented Jun 13, 2017

Any chances it will be included in 1.7 release?

@michaelklishin
Copy link
Member

@siryc yes, there's a good chance it will.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants