[QFJ-771] Session and Settings JMX beans cannot be registered more than once. Created: 24/Jan/14  Updated: 23/Aug/16

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

Type: Bug Priority: Default
Reporter: Vladimir Tsanev Assignee: Unassigned
Resolution: Unresolved Votes: 1
Labels: jmx


 Description   

I need to register, unregister and then register again a Connector - but then the session and settings beans do not appear.

I looked at the source and the problem seems that the SessionJmxExporter's cache with registered sessionId's is not cleared.
ConnectorAdmin registers sessions only if they are not cached by sessionExporter - so the second time session do not show up.



 Comments   
Comment by Christoph John [ 03/Feb/14 ]

How do you register your connector? Can't you simply unregister it prior to re-registering it? Briefly looking at the code it seems there is no unregister method in class org.quickfixj.jmx.JmxExporter.
But shouldn't it work to unregister the connector by yourself by calling jmxExporter.getMBeanServer().unregisterMBean( objectName )?

Comment by Vladimir Tsanev [ 06/Feb/14 ]

I do call jmxExporter.getMBeanServer().unregisterMBean(objectName);.

I will expand on my problem. I need to be able to add and remove sessions at runtime. To achieve this a have a connector per session (there are other reasons that prevents me to use add/remove dynamic sessions, but I think the problem would still be present).
If I want a session to go away I just stop the connector and unregister the bean.
If I want a session to come back some time later I create new settings and new connector instance, but when the session id is the same the session does not show up.

It is because when I unregister the connector the sessionObjectNames map in SessionJmxExporter is still containing entry for my session id.

I think the corresponding entry in SessionJmxExporter.sessionObjectNames should be removed either in ConnectorAdmin.postDeregister or SessionAdmin.postDeregister.

What do you think?

Comment by Christoph John [ 12/Feb/14 ]

OK, I also see in ConnectorAdmin.registerSessions() that the session is only registered if it is not already contained in the sessionObjectNames map. So, yes, your proposed solution to remove the entry in one of the postDeregister() methods should be OK.

Comment by Yukun Song [ 05/Nov/14 ]

I am using a customized DynamicAcceptorSessionProvider in 1.5.3 to create dynamic session with my own session configs instead of the static SessionSettings. Even though I call sessionConnector.removeDynamicSession(sessionID) before sessionConnector.addDynamicSession(session), the previous session is not destroyed. The behaviour includes but not limited to 1) the session jmx doesn't work (i.e. any operation has no effect), 2) the new session thread doesn't own the file handlers of the session store files, so that client can't connect with ResetSeqnum on when logon.

Will the proposed solution solve this issue? Has the solution been added to version 1.6.0? Has anyone been involved in fixing this issue?

Comment by Christoph John [ 05/Nov/14 ]

This issue is currently only planned in to be fixed for 1.6.0 but has not been fixed yet. Could you possibly supply a test case?

Generated at Tue Apr 30 22:50:46 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.