activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jencks (JIRA)" <>
Subject [jira] Created: (AMQ-2049) Race condition cleaning connection using VMTransport
Date Tue, 30 Dec 2008 19:24:05 GMT
Race condition cleaning connection using VMTransport

                 Key: AMQ-2049
             Project: ActiveMQ
          Issue Type: Bug
          Components: Transport
    Affects Versions: 5.3.0
            Reporter: David Jencks
            Assignee: David Jencks
             Fix For: 5.3.0

This problem arises when the server side has a RegionBroker installed and there is a configured
clientID for the connection.

ActiveMQConnection.ensureConnectionInfoSent sends the ConnectionInfo object with the configured
clientID off to the server.  Currently this results in the same ConnectionInfo object in the
AMQConnection and the TransportConnection.

Now when you get to AMQConnection.cleanup() it asynchronously sends a message to the broker
to clean up and immediately sets the configured clientID to null.  When the RegionBroker processes
the remove message the clientID is no longer set (assuming bad luck in thread scheduling)
and it complains:

    public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable
error) throws Exception {
        String clientId = info.getClientId();
        if (clientId == null) {
            throw new InvalidClientIDException("No clientID specified for connection disconnect

One fix for this is to copy the connectionInfo before sending it to the broker.  This is a
small but unnecessary cost for non-vm transports but works.
Another fix might be to send the close message synchronously so it's processed before the
clientID is nulled out.

I'm committing the "copy" solution but IMO this should be reviewed by experts.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message