[QFJ-459] java.lang.StackOverflowError when disconnecting file system Created: 20/Jul/09 Updated: 22/Jun/12 Resolved: 20/May/11 |
|
Status: | Closed |
Project: | QuickFIX/J |
Component/s: | Engine |
Affects Version/s: | 1.3.1, 1.4.0 |
Fix Version/s: | 1.5.1 |
Type: | Bug | Priority: | Default |
Reporter: | Sylvestre COZIC | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 1 |
Labels: | None | ||
Environment: |
Mandriva Linux 2008 EDT, kernel 2.6.24.7 |
Description |
The following error occurs when disconnecting the file system where log files are written on:
Repro steps:
|
Comments |
Comment by Sylvestre COZIC [ 22/Jul/09 ] |
I suggest the following patch :
This should prevent StackOverflow error when an exception is raised while logging an exception. I would also suggest:
This will make sure MessageStore#refresh() is called on logon, so that in case of filesystem failure, file storing sequence numbers is reopen when trying to reconnect. By the way, I did not understood clearly why this method returns false when ConnectionType property is set to Initiator |
Comment by Sylvestre COZIC [ 28/Jan/10 ] |
Hello, Do you need further information to fix this issue? Best regards, |
Comment by Eric Deshayes [ 26/Apr/11 ] |
committed on integration branch rev 1018 |
Comment by Steve Bate [ 02/May/11 ] |
It seems to me that the safest and simplest approach to avoiding the StackOverflow is to simply write the exception message, stack trace and session ID to the standard error stream. The modified code delegates the logging to the SLFJ logger but that logger may also be writing to the same removed file system. This will cause another exception which will be caught in the MINA-related code (when logging incoming messages). It's not clear to me if this will be another source of a StackOverflow or not or result in some other undesired behavior. |
Comment by Eric Deshayes [ 03/May/11 ] |
As discussed with Steve, it is safest to log the error to the standard error stream. |
Comment by Mate Varga [ 22/Jun/12 ] |
A question related to this 'fix': (FileLog.java private void writeMessage(FileOutputStream stream, String message, boolean forceTimestamp) { stream.write(message.getBytes(CharsetSupport.getCharset())); } catch (IOException e) { //QFJ-459: no point trying to log the error in the file if we had an IOException //we will end up with a java.lang.StackOverflowError System.err.println("error writing message to log : "+message); e.printStackTrace(System.err); }} Why do you need to log this error? Why isn't it much-much better to throw an exception or at least call a callback registered by the application? This code can lead to the application not knowing about a possibly critical problem, i.e. qfix not being able to write to the log file stream. |