Problem in a non-persistant session environment
Posted by jpereza on Dec 02, 2010; 12:23pm
URL: https://discuss.orbeon.com/Problem-in-a-non-persistant-session-environment-tp3069014.html
Hello,
I'm facing a problem when deploying Orbeon in WebSphere v7, which has sessions configured to be non-persistent.
The problem arise when I stop my application (not the whole server, only my application) and restart the app. Then trying to execute anything in the application causes an unfamous exist-related error:
"The database directory seems to be locked by another database instance"
Here is part of the log file for this error:
2010-12-02 11:43:52,843 INFO FileLock - File lock last access timestamp: 02-dic-2010 C:\Program Files\IBM\WebSphere\AppServer7\profiles\AppSrv01\installedApps\acf9f1926Node02Cell\Sirius_ear.ear\Sirius.war\WEB-INF\exist-data\dbx_dir.lck
2010-12-02 11:43:52,843 INFO FileLock - Waiting a short time for the lock to be released... C:\Program Files\IBM\WebSphere\AppServer7\profiles\AppSrv01\installedApps\acf9f1926Node02Cell\Sirius_ear.ear\Sirius.war\WEB-INF\exist-data\dbx_dir.lck
2010-12-02 11:44:03,046 INFO FileLock - File lock last access timestamp: 02-dic-2010 C:\Program Files\IBM\WebSphere\AppServer7\profiles\AppSrv01\installedApps\acf9f1926Node02Cell\Sirius_ear.ear\Sirius.war\WEB-INF\exist-data\dbx_dir.lck
2010-12-02 11:44:03,046 INFO FileLock - Waiting a short time for the lock to be released... C:\Program Files\IBM\WebSphere\AppServer7\profiles\AppSrv01\installedApps\acf9f1926Node02Cell\Sirius_ear.ear\Sirius.war\WEB-INF\exist-data\dbx_dir.lck
2010-12-02 11:44:13,250 DEBUG XFormsServer - throwable caught during initialization.
2010-12-02 11:44:13,250 ERROR ProcessorService - Exception at line 135, column 60 of oxf:/ops/pfc/xforms-epilogue.xpl (reading processor output: name='document', id='xhtml-data')
org.exist.EXistException: The database directory seems to be locked by another database instance. Found a valid lock file: C:\Program Files\IBM\WebSphere\AppServer7\profiles\AppSrv01\installedApps\acf9f1926Node02Cell\Sirius_ear.ear\Sirius.war\WEB-INF\exist-data\dbx_dir.lck
at org.exist.storage.BrokerPool.canReadDataDir(BrokerPool.java:680)
at org.exist.storage.BrokerPool.<init>(BrokerPool.java:632)
at org.exist.storage.BrokerPool.configure(BrokerPool.java:203)
at org.exist.xmldb.DatabaseImpl.configure(DatabaseImpl.java:100)
at org.exist.xmldb.DatabaseImpl.getLocalCollection(DatabaseImpl.java:175)
at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:155)
at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:150)
at org.xmldb.api.DatabaseManager.getCollection(Unknown Source)
at org.orbeon.oxf.processor.xmldb.XMLDBProcessor.getCollection(XMLDBProcessor.java:156)
at org.orbeon.oxf.processor.xmldb.XMLDBProcessor.executeQuery(XMLDBProcessor.java:220)
at org.orbeon.oxf.processor.xmldb.XMLDBProcessor.query(XMLDBProcessor.java:179)
at org.orbeon.oxf.xforms.state.XFormsPersistentApplicationStateStore$XMLDBAccessor.query(XFormsPersistentApplicationStateStore.java:321)
at org.orbeon.oxf.xforms.state.XFormsPersistentApplicationStateStore.executeQuery(XFormsPersistentApplicationStateStore.java:224)
at org.orbeon.oxf.xforms.state.XFormsPersistentApplicationStateStore.expireAllPersistentUseCollection(XFormsPersistentApplicationStateStore.java:142)
at org.orbeon.oxf.xforms.state.XFormsPersistentApplicationStateStore.instance(XFormsPersistentApplicationStateStore.java:117)
at org.orbeon.oxf.xforms.state.XFormsStateManager.storeDocumentState(XFormsStateManager.java:200)
at org.orbeon.oxf.xforms.state.XFormsStateManager.cacheOrStore(XFormsStateManager.java:178)
at org.orbeon.oxf.xforms.state.XFormsStateManager.afterInitialResponse(XFormsStateManager.java:75)
at org.orbeon.oxf.xforms.processor.XFormsToXHTML.doIt(XFormsToXHTML.java:224)
at org.orbeon.oxf.xforms.processor.XFormsToXHTML.access$000(XFormsToXHTML.java:43)
at org.orbeon.oxf.xforms.processor.XFormsToXHTML$1.readImpl(XFormsToXHTML.java:64)
at org.orbeon.oxf.processor.impl.ProcessorOutputImpl$TopLevelOutputFilter.read(ProcessorOutputImpl.java:263)
at org.orbeon.oxf.processor.impl.ProcessorOutputImpl.read(ProcessorOutputImpl.java:406)
[...]
After some investigation, I have found the origin of this error. This is the sequence of events:
* Stop the application
** The servlets are destroyed
*** The EXistServlet stops the database instances
** The sessions are destroyed
*** Orbeon calls its SessionListeners
**** XFormsStateStore is notified and calls expireBySessionId()
**** XFormsPersistentApplicationStateStore executes a query to delete the session data
***** BUT as the database instance has been stopped, a new instance is configured and started
** The servlet context is destroyed
The result is that there is a database instance that is still alive although the application has been stopped.
This live database instance is what is causing the error above.
Here is a log when the application stop:
2010-12-02 11:40:39,937 INFO ProcessorService - Servlet - Servlet destroyed.
2010-12-02 11:40:40,015 INFO FileLock - Deleting lock file: C:\Program Files\IBM\WebSphere\AppServer7\profiles\AppSrv01\installedApps\acf9f1926Node02Cell\Sirius_ear.ear\Sirius.war\WEB-INF\exist-data\journal.lck
2010-12-02 11:40:40,015 INFO FileLock - Deleting lock file: C:\Program Files\IBM\WebSphere\AppServer7\profiles\AppSrv01\installedApps\acf9f1926Node02Cell\Sirius_ear.ear\Sirius.war\WEB-INF\exist-data\dbx_dir.lck
2010-12-02 11:40:40,015 INFO ProcessorService - Servlet - Servlet destroyed.
2010-12-02 11:40:40,125 INFO Configuration - Reading configuration from file C:\Program Files\IBM\WebSphere\AppServer7\profiles\AppSrv01\installedApps\acf9f1926Node02Cell\Sirius_ear.ear\Sirius.war\WEB-INF\exist-conf.xml
2010-12-02 11:40:40,156 WARN eXistURLStreamHandlerFactory - The JVM has already an URLStreamHandlerFactory registered, skipping...
2010-12-02 11:40:40,156 INFO eXistURLStreamHandlerFactory - System property java.protocol.handler.pkgs has not been updated.
2010-12-02 11:40:40,171 INFO Configuration - Add catalog uri file:/C:/Program%20Files/IBM/WebSphere/AppServer7/profiles/AppSrv01/installedApps/acf9f1926Node02Cell/Sirius_ear.ear/Sirius.war//WEB-INF/catalog.xml
2010-12-02 11:40:40,171 INFO GrammarPool - Initializing GrammarPool.
2010-12-02 11:40:40,250 INFO DefaultCacheManager - Cache settings: 49.152k; totalPages: 12.288; maxCacheSize: 11.059
2010-12-02 11:40:40,250 INFO XQueryPool - QueryPool: size = 128; maxStackSize = 5; timeout = 120.000; timeoutCheckInterval = 30.000
2010-12-02 11:40:40,281 INFO IndexManager - Registered index org.exist.indexing.ngram.NGramIndex as ngram-index
2010-12-02 11:40:40,281 INFO IndexManager - Registered index org.exist.fulltext.FTIndex as ft-legacy-index
2010-12-02 11:40:40,359 INFO DatabaseImpl - Collection /db/orbeon/xforms/cache not found
2010-12-02 11:40:40,609 INFO OrbeonSessionListener - Session Listener - Session destroyed.
2010-12-02 11:40:41,140 INFO OrbeonServletContextListener - Servlet Context Listener - Context destroyed.
Please, could you fix this issue?
Thanks in advance.
jpereza