qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Goldstein (JIRA)" <j...@apache.org>
Subject [jira] [Created] (QPID-3291) Broker incorrectly sets TTL to 0 for messages about to expire
Date Fri, 03 Jun 2011 15:27:47 GMT
Broker incorrectly sets TTL to 0 for messages about to expire

                 Key: QPID-3291
                 URL: https://issues.apache.org/jira/browse/QPID-3291
             Project: Qpid
          Issue Type: Bug
          Components: C++ Broker
            Reporter: Andy Goldstein
         Attachments: QPID-3291.patch

When qpid::broker::Message::adjustTtl() is called prior to delivering a message to a peer,
it adjusts the TTL down to reflect the time the message spent in the broker.  For a message
that has expired, it sets the TTL to 1.  The current logic calculates the remaining TTL as
the difference, in nanoseconds, between the current time and the expiration time.  If this
value is greater than 0, it converts the remaining TTL to milliseconds and sets it on the
message; otherwise, it sets the TTL to 1.

This logic could result in a message that is about to expire receiving a TTL of 0.  This would
occur if the remaining TTL is somewhere between 1 and 1,000,000 ns.  When the division occurs
to convert to ms, it would result in some number between 0 and 1, which is rounded down to
0.  Instead, this value should be 1.

To fix this, the remaining TTL should be compared against 1,000,000.  If it is >= to that
number, then the conversion can proceed successfully; otherwise, the TTL should be set to

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org

View raw message