Toggle Current Issue
ID: 1357 Reporter: tero.katajainen
Status:
New New
Resolution:
unresolved
Category: Orion Reported Version: 2.0.7
Last seen Version: 2.0.7 Fixed Version:
Platform: Unspecified/All OS: Unspecified/All
Java version: 1.5 Severity: normal
Visibility: Public Public
Summary: JMS Temporary queue blocks on send if already deleted
Description: I've found the following:

I have a JMS queue, to which I send a message with JMSReplyTo set to a temporary queue created by session.createTemporaryQueue(). After sending the message, the client waits to receive a message on this temporary queue and the closes the temporary queue with delete() and closes the session.

If the server answering to the request first sends a response to the temporyry queue and the client reads it, also deleting the queue, the next time the server tries to write to this deleted queue, both the original request queue and the send-method to the temporary queue block forever. The correct behaviour would be to throw an exception, notifying that the temporary queue has been deleted.

Pseudocode, client:

QueueSession session = connection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
TemporaryQueue responseQueue = session.createTemporaryQueue();
Message requestMessage = session.createMessage();
message.setJMSReplyTo(responseQueue);
QueueSender sender = session.createSender(requestQueue);
sender.send(requestMessage);
QueueReceiver replyReceiver = session.createReceiver(responseQueue);
Message replyMessage = receiver.receive();
receiver.close();
responseQueue.delete();
requestSender.close();
session.close();

Pseudocode, server


QueueSession responseSession = connection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);

QueueReceiver requestReceiver = session.createReceiver(requestQueue);
Message requestMessage = receiver.receive();

QueueSession session = connection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(requestMessage.getJMSReplyTo());
sender.send(replyMessage);
sender.close();
session.close();

// At this point, wait until the client has deleted the queue

QueueSession session = connection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(requestMessage.getJMSReplyTo());
sender.send(replyMessage); // The server blocks here
sender.close();
session.close();

responseSession.close();

Workaround: Make sure only one message is sent to the JMS temporary queue by setting JMSReplyTo to null and checking it before trying to send.


Collapse Public tero.katajainen 20060719 10:16:06
Modification: Issue created