Hibernate session invalid in background threads
-----------------------------------------------
Key: XWIKI-1828
URL: http://jira.xwiki.org/jira/browse/XWIKI-1828
Project: XWiki Platform
Issue Type: Bug
Components: Core
Affects Versions: 1.1.1
Reporter: Sergiu Dumitriu
Anca noticed while working on XWatch that sometimes a "session is closed"
exception is thrown when updating the feeds.
{noformat}
org.hibernate.SessionException: Session is closed!
at
org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:50)
at org.hibernate.impl.SessionImpl.setFlushMode(SessionImpl.java:1271)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.getSession(XWikiHibernateBaseStore.java:155)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:595)
at
com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java:568)
at
com.xpn.xwiki.store.XWikiHibernateStore.searchDocumentsNamesInternal(XWikiHibernateStore.java:1825)
at
com.xpn.xwiki.store.XWikiHibernateStore.searchDocumentsNames(XWikiHibernateStore.java:1811)
at
com.xpn.xwiki.store.XWikiHibernateStore.searchDocumentsNames(XWikiHibernateStore.java:2231)
at
com.xpn.xwiki.store.XWikiCacheStore.searchDocumentsNames(XWikiCacheStore.java:200)
at
com.xpn.xwiki.plugin.feed.FeedPlugin.updateFeedsInSpace(FeedPlugin.java:310)
at com.xpn.xwiki.plugin.feed.UpdateThread.update(UpdateThread.java:82)
at com.xpn.xwiki.plugin.feed.UpdateThread.run(UpdateThread.java:56)
at java.lang.Thread.run(Thread.java:619)
{noformat}
>From the above stacktrace, I think that the problem is caused by the fact that
>at some point the context object is cloned along with its data members,
>including the session object; this object is closed in another thread, and the
>reference is deleted from that context object, but it still exists in the
>context stored in the current thread.
The proper fix would be to rethink the way the context is stored in background
threads, but an easy workaround is to catch this particular exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.xwiki.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications