[QFJ-167] SessionNotFound, while connection is still active Created: 27/Apr/07  Updated: 11/Feb/09  Resolved: 11/May/07

Status: Closed
Project: QuickFIX/J
Component/s: Build
Affects Version/s: 1.1.0
Fix Version/s: 1.1.0

Type: Bug Priority: Default
Reporter: Andre Mermegas Assignee: Steve Bate
Resolution: Fixed Votes: 0
Labels: None
Environment:

java 1.5, windows



 Description   

I'm getting this now randomly often, i think the problem is Session migrating from HashMap to WeakHashMap and then losing reference due to weak collection strategy.

2007/04/27 15:39:20:437 EDT [ERROR] TransportSession - <quickfix.SessionNotFound>quickfix.SessionNotFound
at quickfix.Session.sendToTarget(Session.java:421)



 Comments   
Comment by Steve Bate [ 27/Apr/07 ]

I've looked into this and it actually appears the WeakHashMap will not ever release it's references (a different and opposite bug). The connectors and the WeakHashMap have strong references to the sessions and the session references the session ID so the key will never garbage collected. I need to investigate this further but it doesn't appear it would be causing the symptoms you describe.

Comment by Andre Mermegas [ 27/Apr/07 ]

hrm. somehow the session is removed from the map, i stepped into the source and saw it was empty even though heartbeats and connection was still up. thats what led me to weakhashmap idea from my brief look at Session source. I'll mess around some more as well and let you know what i come up with.

have you ever seen this before in your usage?

Comment by Steve Bate [ 10/May/07 ]

Do you have any more information on this issue?

Comment by Andre Mermegas [ 10/May/07 ]

I changed the type in Session.sessions from weakhashmap to hashmap and havent had any problems since.

Comment by Steve Bate [ 11/May/07 ]

Hello Andre,

I've removed the WeakHashMap and instead I'm unregistering sessions when a connector (acceptor or initiator) is stopped. I still don't know how the WeakHashMap would have caused the problem and it's strange no one else has reported it. Still, I think the new implementation is better anyway. Thanks for the report.

Steve

Comment by Andre Mermegas [ 11/May/07 ]

Hey Steve,

Yeah, I'm not completely sure either but in my very quick look at the source i didn't see any other way for it to get taken from the map, i saw no calls to .remove or anything elsewhere.

anyway, sounds good. thanks.

Comment by Ian Paul Johnson [ 12/Jun/07 ]

Just to let you know, last night i had exactly the same problem, whereby i got 2 SessionNotFoundException when the lookup failed - was still heartbeating but no trading activity overnight - the first attempt to send order failed in send. There were no intervening connectivity or other problems. - using 1.1.0. Reconnecting refreshed the session collection and all continued without problems and no java vm restart.

Generated at Fri May 03 06:03:23 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.