Hi devs,

We've identified yesterday one scenario when the doc cache can become 
corrupted. By corrupted I mean having a document in it which is empty and has 
isNew set to true.

Here it is:

* Imagine we're doing a hibernate query calling XHS.execute() 
(executeRead()/executeWrite()). We're thus in a hibernate session/transaction
* Now imagine that in the doInHibernate callback we start another request.
* Also imagine that the first query was executed in the "wiki1" wiki 
(setDatabase has been called and the DB is positionned in this wiki)
* Now imagine that the second nested query is done on a different wiki (for 
example asking to get the user doc from the main wiki)
* The result will be that the doc will not be found by hibernate and 
loadXWikiDoc will return a new doc with isNew set to true
* The doc cache will save this new doc in the cache
* Subsequent calls for this document will return the invalid document (with 
isNew = true)

This is what was happening for http://jira.xwiki.org/browse/XWIKI-8160, the 
problem being that HqlQueryExecutor was doing 2 nested queries. JV is fixing 
this today.

I'm reporting this here because it's important not to do nested queries like. 
We're going to generate an exception when we do to try to locate them if there 
are any more.

Thanks
-Vincent

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to