Details
Description
Recently when our system was restarted, occasionally occur I/O exception, the following:
quickfix.ConfigError: error during session initialization
at quickfix.mina.initiator.AbstractSocketInitiator.createSessions(AbstractSocketInitiator.java:135)
at quickfix.mina.initiator.AbstractSocketInitiator.createSessionInitiators(AbstractSocketInitiator.java:84)
at quickfix.SocketInitiator.initialize(SocketInitiator.java:84)
at quickfix.SocketInitiator.start(SocketInitiator.java:64)
at com.rootnet.fix.framework.FixModule.startup(FixModule.java:142)
at com.rootnet.fix.algo.FixAlgoGateway.main(FixAlgoGateway.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:238)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.RuntimeException: java.io.IOException
at quickfix.FileStoreFactory.create(FileStoreFactory.java:80)
at quickfix.Session.<init>(Session.java:338)
at quickfix.DefaultSessionFactory.create(DefaultSessionFactory.java:156)
at quickfix.mina.SessionConnector.createSession(SessionConnector.java:114)
at quickfix.mina.initiator.AbstractSocketInitiator.createSessions(AbstractSocketInitiator.java:129)
... 11 more
Caused by: java.io.IOException
at quickfix.FileStore.initializeSessionCreateTime(FileStore.java:133)
at quickfix.FileStore.initializeCache(FileStore.java:120)
at quickfix.FileStore.initialize(FileStore.java:113)
at quickfix.FileStore.<init>(FileStore.java:100)
at quickfix.FileStoreFactory.create(FileStoreFactory.java:78)
... 15 more
I check .session file in store directory, find that it is an empty file. And as long as this file is empty, start FIX engine must occur this I/O exception.
I compare quickfixj1.4.0 and quickfixj1.5.2, find the code was strengthened, increased 'sessionTimeFile.length() > 0', by this way when .session file is an empty file, will execute storeSessionTimeStamp(), program will be correctly executed. This handle whether it is in order to avoid .session empty file lead to I/O exception. So what science would generate a empty .session file?
--quickfixj1.5.2
private void initializeSessionCreateTime() throws IOException {
final File sessionTimeFile = new File(sessionFileName);
if (sessionTimeFile.exists() && sessionTimeFile.length() > 0) {
final DataInputStream sessionTimeInput = new DataInputStream(new BufferedInputStream(
new FileInputStream(sessionTimeFile)));
try
catch (final Exception e)
{ throw new IOException(e.getMessage()); }finally
{ sessionTimeInput.close(); }} else
{ storeSessionTimeStamp(); }}
Attachments
Issue Links
- is related to
-
QFJ-653 IOException if sessionTimestamp file exists but is empty
- Closed