mraible opened a new pull request, #214: URL: https://github.com/apache/roller/pull/214
Fixes [ROL-2185](https://issues.apache.org/jira/browse/ROL-2185), which is behind the intermittent `RollerAtomManagementTest.commentModeration` failure (line 419, a deleted comment is still found). It failed on CI for #160 and locally on #155. Approving or deleting a comment queues a search re-index of its entry, which runs on a background thread and loads the entry's approved comments. If that read overlaps a comment being deleted, EclipseLink can put the deleted comment back into its shared cache after the delete commits. `getComment(id)` uses `EntityManager.find`, which is answered from that cache, so it returns the deleted comment even though the row is gone. List pages and feeds use JPQL queries and aren't affected. The fix sets `eclipselink.cache.shared.WeblogEntryComment=false` in `persistence.xml`, so comments are always read from the database. Every other entity keeps the shared cache. How I verified it: - A throwaway stress test (attached to the JIRA ticket) creates a comment, queues a re-index of its entry, deletes the comment and looks it up. On master the deleted comment came back 128 times out of 1500, with the database row gone every time, and 0 times out of 1500 with the re-index turned off. With this change it's 0 out of 1500 with the re-index on. - The new `CommentSharedCacheTest` checks that a loaded comment isn't in the shared cache while a weblog entry still is. It fails without the `persistence.xml` change and passes with it. - The full build passes (492 tests), and so does `apache-rat:check`. The cost is that loading a comment by id now always goes to the database. Comments are mostly read through queries anyway, so I don't expect a noticeable difference. I left `CHANGES.md` alone because master's 7.0.0 section doesn't list bug fixes yet. Happy to add a line if we want one. The same race probably exists on `roller-6.1.x`, but I've only reproduced it on master. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
