[MGNLOBS-36] Unclosed sessions on CommandEventListener#onEvent failures Created: 01/Sep/15  Updated: 15/Apr/16  Resolved: 15/Sep/15

Status: Closed
Project: Observation
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.4

Type: Bug Priority: Neutral
Reporter: Evzen Fochr Assignee: Evzen Fochr
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 1d 20m
Original Estimate: Not Specified

Issue Links:
relation
is related to MAGNOLIA-6365 Unclosed sessions on JcrResourceOrigi... Closed
is related to MAGNOLIA-6374 Create integration test for Observati... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Kromeriz 11
Story Points: 2

 Description   

When info.magnolia.module.observation.commands.CommandEventListener#onEvent fails during the execution, sessions are not closed properly.



 Comments   
Comment by Milan Divilek [ 07/Sep/15 ]

Reopen: Fix release context when implementation of CommandEventListener is used, but if own implementation of javax.jcr.observation.EventListener is used then context is not released. See stacktrace in ticket description.

Comment by Evzen Fochr [ 10/Sep/15 ]

Create integration test for more than one event.

Comment by Jan Haderka [ 11/Sep/15 ]

Multiple things wrong with the test

  • first you are mocking the context, while we want to see how this works against real context. And SystemContext at that, not just the web context.
  • second you just try to get the instance of the web context, you are not attempting to modify the repository (write some content) which is where I would expect problems to occur (either due to invalid session or due to modifications of the repo outside of the session (you should try to modify repo content from the event listener and from the main part of the test and see that you can see those changes made by event listener in the repo after the execution).
Comment by Jan Haderka [ 14/Sep/15 ]

Looks better, but:

  • test still doesn't prove that what's inside of even listener is SystemContext (wrapped in SimpleContext )
  • the events are executed once, not twice (yes you have two events, but they are aggregated in same iterator and we group execution of those so release is called just once after execution of both) so we still don't have proof that second batch of events will be able to access the repo.
Comment by Jan Haderka [ 15/Sep/15 ]

After sleeping over it, I have one extra request for test: Don't mock the observer but have observation triggered through real event. So register proper observer on the repo and then make change in the repo to trigger first event and then second change to trigger the second event after first one have been processed. Why? Because we need lifetime long session to keep observation running, while now we are also closing sessions from within observers so we need to be sure that those are not the same sessions as well.

Generated at Mon Feb 12 10:23:24 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.