activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Danielius Jurna (JIRA)" <>
Subject [jira] Commented: (AMQ-724) Stomp client is not removed from the broker on client disconnect
Date Mon, 29 May 2006 00:24:51 GMT
    [ ] 

Danielius Jurna commented on AMQ-724:

The problem I found is whith both stomp transport and broker iself.
Somehow Stomp subscription starts prefetching and sending messages before it adds Consumer
to the broker. If connection during this prefetching is lost, connection is removed, but subscription
is still added.

There is quick  hack for that in AbstractConnection.processAddConsumer(): 

    public Response processAddConsumer(ConsumerInfo info) throws Exception {
        SessionId sessionId = info.getConsumerId().getParentId();
        ConnectionId connectionId = sessionId.getParentId();
        ConnectionState cs = lookupConnectionState(connectionId);
        SessionState ss = cs.getSessionState(sessionId);
        if( ss == null )
            throw new IllegalStateException("Cannot add a consumer to a session that had not
been registered: "+sessionId);
        log.trace("Adding consumer to broker. Stomp client blocks here - waiting for prefetching
to complete.");
        broker.addConsumer(cs.getContext(), info);
        try {
        } catch (IllegalStateException ex) {
        		// If during broker.addConsumer() exception occures, connection is destroyed. We
need to remove consumer
        		log.warn("Cannot find connection after adding subscription! Probably error when
prefetching messages", ex);
        		broker.removeConsumer(cs.getContext(), info);
        		throw ex;
        return null;

> Stomp client is not removed from the broker on client disconnect
> ----------------------------------------------------------------
>          Key: AMQ-724
>          URL:
>      Project: ActiveMQ
>         Type: Bug

>   Components: Transport
>     Versions: 4.0
>  Environment: Linux, Java 1.5.0_06
>     Reporter: Danielius Jurna
>  Attachments:
> If Stomp client crashes (or disconnects unexpectedly) when there are unconsumed messages
in the broker, the subscriptions are not removed from the broker and some phantom consumer
is still consuming messages. If you connect other client, it receives only half messages (other
half messages goes to that phantom consumer still left afrter client disconnect). There are
no error logs in activemq logs. We are using stomp client, whith client acknowledge mode,
so on broker restart, all messages are delivered properly. You can also see in jmx console,
that subscription still exists whithout any connection left.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message