A "org.hibernate.StaleStateException: Batch update returned unexpected row" exception may occur when accessing documents in the Document Library.
More specifically, DLFileRank is used to keep track of the last 5 documents accessed by a user. When the user accesses a document the oldest DLFileRank is deleted. However, if multiple threads or multiple cluster attempts to remove the same DLFileRank, the above exception will occur.
This exception is a little misleading since there is no real problem in deleting the same DLFileRank multiple times. So to address this issue, the exception has been turned into a warning in the logs.
An alternative solution is to disable file ranks by setting the following in portal(-ext).properties.