[QFJ-133] Return of bug 89 - session lookup causes an NPE if JdbcLog is miconfigured initially Created: 07/Feb/07  Updated: 12/Apr/07  Resolved: 11/Feb/07

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

Type: Bug Priority: Default
Reporter: Toli Kuznets Assignee: Steve Bate
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File jdbc-oomErrorSessionLookupNPE.patch     Text File out.txt    
Issue Links:
Relates
relates to QFJ-89 sessionID added to global Sessions af... Closed
is related to QFJ-134 Stack overflow when JdbcLog fails to ... Closed

 Description   

I'm able to reproduce the same situation as was in bug 89 initially (http://www.quickfixj.org/jira/browse/QFJ-89)

If you misconfigure the JdbcLog (wrong db name, or just turn off the db altogether), you get into a situation where JdbcLog calls into LogUtil.logThrowable() which tries to lookup the session through Session.lookupSession() which comes back as null and that produces an NPE.

There are actually 2 bugs:
1. When you create a session you try to log session creation.
2. if jdbc log is misconfigured, we get an exception and go into LogUtil.logThrowable() which calls through to Session.lookupSession()
3. since we haven't registered the session yet we get an NPE in LogUtil.logThrowable()

Second bug (this has to do with proxool)
1. When we get the NPE in the above scenario, we try to log it again, which essentially ends up doing this recursively and we run out of memory (see the attached stack trace).

I will create an issue to track the 2nd bug separately as well.

I am submitting a patch that's fixing both bugs:
1. Move the session registration code back from DefaultSessionFactory.create() to the Session() constructor
2. Modify the behaviour of the JdbcLog.insert() to keep track if we are being called recursively and ignore the recursive request in that case. Probably would be a good time to log somewhere else in that case though.



 Comments   
Comment by Toli Kuznets [ 07/Feb/07 ]

Patch containing the fix to both bugs described in this issue
to be applied in core/ subdirectory

Comment by Toli Kuznets [ 07/Feb/07 ]

Stacktrace that shows the NPE for when session is not found if the jdbc logger throws an error due to misconfiguraiton.

also contains the stacktrace for eventual OutOfMemoryException b/c of recursive falied attemps to log an error (when JdbcLog is misconfigured)

Generated at Thu May 16 18:41:38 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.