-
1. Re: Exception: Failed to read payload
timfox May 24, 2006 11:18 AM (in response to mwelss)Can you post a test case that replicates it and I'll take a look?
Thanks. -
2. Re: Exception: Failed to read payload
mwelss May 24, 2006 11:51 AM (in response to mwelss)Not sure if I can 'extract' the test case from our application...
Can it be a concurrency issue? The consumers are all servlets, to which the messages are delivered almost 'at the same time'.
In other words, would it help to synchronize on the message?
Thanks! -
3. Re: Exception: Failed to read payload
timfox May 24, 2006 12:05 PM (in response to mwelss)"mwelss" wrote:
Looking at the code, the payload seems to be serialized, but on the producer I set the delivery-mode to non-persistent, so why
serialize anyway? It's all in one jboss, no cluster etc.
This is required by the JMS spec.
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/ObjectMessage.html
ObjectMessage::setObject javadoc:
Sets the serializable object containing this message's data. It is important to note that an ObjectMessage contains a snapshot of the object at the time setObject() is called; subsequent modifications of the object will have no effect on the ObjectMessage body.
So we need to basically need to copy the message when it is set so if the user than changes the original object the object message is unchanged. -
4. Re: Exception: Failed to read payload
timfox May 24, 2006 12:10 PM (in response to mwelss)"mwelss" wrote:
Can it be a concurrency issue? The consumers are all servlets, to which the messages are delivered almost 'at the same time'.
Possibly. Let me see if I can replicate it. -
5. Re: Exception: Failed to read payload
timfox May 24, 2006 2:30 PM (in response to mwelss)I have managed to replicate this.
It's a race condition due to >1 threads concurrently deserializing the message.
The fix seems to be trivial. So hopefully will be in the next release.
In the mean-time you should be able to work around by synchronizing on the underlying message as you mentioned. Although is slightly more complex since the message you have is actually a proxy.
You need to do something like:OjbectMessage m = (ObjectMessage)consumer.receive(); MessageProxy mp = (MessageProxy)m; JBossMessage jbm = mp.getMessage(); synchronized (mp.getMessage()) { Object myObject = m.getObject(); }
I haven't tried it but it should work.
Of course the above is completely non portable so you want to remove it once the fix is applied. -
6. Re: Exception: Failed to read payload
mwelss May 26, 2006 5:19 AM (in response to mwelss)Yes, sychronizing fixes the problem!
Thanks a lot!