[
https://issues.apache.org/jira/browse/QPID-7774?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Rudyy updated QPID-7774:
-----------------------------
Attachment: 0001-QPID-7774-Improve-locking-when-using-failover-latch.patch
Keith,
I reviewed the changes you made and would like to suggest further improvements
to the code invoking failover latch. It seems when failover finishes
successfully, in failover thread method
{{AMQProtocolHandler#getFailoverLatch()}} is called. If {{receive()}} or
{{receiveNoWait()}} are invoked from main thread, they might end-up in calling
{{AMQProtocolHandler#blockUntilNotFailingOver}}, which holds the lock
{{#_failoverLatchChange}} whilst calling {{_failoverLatch#await}}. As result,
failover thread would be blocked for 30 seconds, as
{{AMQProtocolHandler#getFailoverLatch()}} will not reurn until lock is
released. It seems that there is no need to call
{{AMQProtocolHandler#getFailoverLatch()}} from the failover thread, as we
already have reference to the failover latch. Additionally, holding
{{#_failoverLatchChange}} whilst calling {{_failoverLatch#await}} looks
redundant to me. I attached a patch making some changes to the code in order to
fix the undesired behaviour. What do you think about applying the patch as part
of this JIRA?
> [Qpid JMS Client 0-x] [0-8..0-91] MessageConsumer#receiveNoWait() always
> returns null after a successful failover
> -----------------------------------------------------------------------------------------------------------------
>
> Key: QPID-7774
> URL: https://issues.apache.org/jira/browse/QPID-7774
> Project: Qpid
> Issue Type: Bug
> Components: Java Client
> Affects Versions: 0.22, 0.32, qpid-java-6.0.6, qpid-java-6.1.2
> Reporter: Keith Wall
> Assignee: Keith Wall
> Fix For: qpid-java-client-0-x-6.3.0, qpid-java-6.1.3
>
> Attachments:
> 0001-QPID-7774-Improve-locking-when-using-failover-latch.patch
>
>
> If the client fails over when AMQP 0-8..0-91 is in use and the application is
> using a synchronous message receiver calling #receiveNoWait(), the
> application will always receive null. The defect is longstanding. It goes
> back at least until 0.22. Other synchronous receive calls and asynchronous
> message listeners are unaffected. The 0-10 path is unaffected too.
> The problem is {{org.apache.qpid.client.AMQConnection#isFailingOver}} and
> org.apache.qpid.client.AMQProtocolHandler#startFailoverThread. The former
> assumes that the failover latch will be nullified after a successful failover
> but {{startFailoverThread}} does not organise for this.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]