[QFJ-997] Http proxy doesnt reconnect upon lost fix session Created: 04/Dec/20  Updated: 26/Jan/22

Status: Open
Project: QuickFIX/J
Component/s: Build
Affects Version/s: 2.1.1
Fix Version/s: None

Type: Bug Priority: Default
Reporter: Krys Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: http, initiator, proxy, reconnection


 Description   

Fix engine (initiator) doesnt reconnect upon the acceptor's restart when http proxy is being used. It keeps displaying "Pending connection not established after 270734 ms.", which is a consequence of not reconnecting at all. Is there any workaround for http proxy to trigger reconnection?

We have configured ReconnectInterval, ProxyType=http, ProxyVersion=1.1.

If we change proxy type to socks we are seeing the reconnect attempt due to /org/apache/mina/proxy/ProxyConnector.java:181, but would be nice to have the same functionality for http proxy. I also cant see any obvious way to set reconnectionNeeded variable that would potentially trigger the reconnection which i have tested by resetting it myself with a debugger.



 Comments   
Comment by Christoph John [ 05/Dec/20 ]

I am not aware of any special handling which could stop reconnecting from working only for http proxy... Could it be that the http connection is still considered "active" on the proxy? Could you please check that with "netstat" or some other tool which lists open sockets.
Could you please also create a stack dump when QFJ is in the state of "Pending connection not established..."

Comment by Krys [ 07/Dec/20 ]

Unlike http proxy, i am observing socks proxy reconnecting, probably due to this:

if (proxyIoSession.getRequest() instanceof SocksProxyRequest || proxyIoSession.isReconnectionNeeded())

{ return conFuture; }

Unless i need to configure http proxy with something else to get it reconnected.
we are not seeing any outbound connection in this scenario, although the same tcp port remains open.
In the state of "Pending connection...", there are two QFJ threads:

"QFJ Message Processor" #35 daemon prio=5 os_prio=0 tid=0x000000002b144800 nid=0xb090 waiting on condition [0x000000002fb8e000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)

  • parking to wait for <0x00000005d05d60d8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
    at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
    at quickfix.mina.QueueTrackers$1.poll(QueueTrackers.java:45)
    at quickfix.mina.SingleThreadedEventHandlingStrategy.getMessage(SingleThreadedEventHandlingStrategy.java:122)

"QFJ Timer" #34 daemon prio=5 os_prio=0 tid=0x000000002b144000 nid=0xa3a8 in Object.wait() [0x000000002f77f000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at org.apache.mina.core.future.DefaultIoFuture.await0(DefaultIoFuture.java:218)

  • locked <0x00000005d0640f10> (a org.apache.mina.core.future.DefaultConnectFuture)
    at org.apache.mina.core.future.DefaultIoFuture.awaitUninterruptibly(DefaultIoFuture.java:174)
    at quickfix.mina.initiator.IoSessionInitiator$ConnectTask.pollConnectFuture(IoSessionInitiator.java:232)
    at quickfix.mina.initiator.IoSessionInitiator$ConnectTask.run(IoSessionInitiator.java:207)
  • locked <0x00000005d05fdd80> (a quickfix.mina.initiator.IoSessionInitiator$ConnectTask)

QFJ Timer doesnt stop on breakpoints in IoSessionInitiator.ConnectTask#connect(), SocketChannelImpl#connect() or Net#connect() anymore.

Let me know if anything else would be useful to check.

Comment by Christoph John [ 14/Dec/20 ]

Unlike http proxy, i am observing socks proxy reconnecting, probably due to this:

if (proxyIoSession.getRequest() instanceof SocksProxyRequest || proxyIoSession.isReconnectionNeeded())
{ return conFuture; } 

Where is that code from? If that is from MINA then it could also be a MINA bug.

Comment by Krys [ 14/Dec/20 ]

That is right. it comes from MINA core: org.apache.mina.proxy.ProxyConnector#connect0:181

Comment by Christoph John [ 15/Dec/20 ]

So if I understood you right you could trigger the reconnection by setting isReconnectionNeeded to true in the debugger? If yes, then it should be a MINA bug, shouldn't it?

Comment by Krys [ 16/Dec/20 ]

Correct, when i set the re-connection needed with a debugger it does the job. In this case, we close this JIRA, right?

Comment by Christoph John [ 16/Dec/20 ]

It would be good if you could open a MINA issue and link to this issue. Let me know if I should open the issue against MINA. Thanks so far

Comment by Krys [ 14/Jan/21 ]

I would appreciate if you would open the issue with them.

Comment by Christoph John [ 26/Jan/22 ]

https://issues.apache.org/jira/browse/DIRMINA-1159

Generated at Sat Nov 23 07:26:35 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.