Skip to content

OAK-12300 : Remove ServiceListener after awaitServiceEvent completes#3005

Open
rishabhdaim wants to merge 1 commit into
trunkfrom
OAK-12300
Open

OAK-12300 : Remove ServiceListener after awaitServiceEvent completes#3005
rishabhdaim wants to merge 1 commit into
trunkfrom
OAK-12300

Conversation

@rishabhdaim

@rishabhdaim rishabhdaim commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

No description provided.

The EventServiceListener was never removed from the BundleContext after
awaitServiceEvent completed (either successfully or via timeout). This caused:

1. Resource leaks - listeners accumulated across test runs
2. Test interference - listeners from previous tests continued receiving events
3. Intermittent test failures - unrelated service events could be captured,
   causing timeout errors when waiting for specific service events

Fix: Add try-finally block to ensure bundleContext.removeServiceListener()
is always called after the await completes, preventing listener accumulation
and cross-test event interference.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Commit-Check ❌

Commit rejected by Commit-Check.                                  
                                                                  
  (c).-.(c)    (c).-.(c)    (c).-.(c)    (c).-.(c)    (c).-.(c)  
   / ._. \      / ._. \      / ._. \      / ._. \      / ._. \   
 __\( C )/__  __\( H )/__  __\( E )/__  __\( C )/__  __\( K )/__ 
(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
   || E ||      || R ||      || R ||      || O ||      || R ||   
 _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._ 
(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)
 `-´     `-´  `-´     `-´  `-´     `-´  `-´     `-´  `-´     `-´ 
                                                                  
Commit rejected.                                                  
                                                                  
Type message check failed ==> OAK-XXXXX: Remove ServiceListener after awaitServiceEvent completes

The EventServiceListener was never removed from the BundleContext after
awaitServiceEvent completed (either successfully or via timeout). This caused:

1. Resource leaks - listeners accumulated across test runs
2. Test interference - listeners from previous tests continued receiving events
3. Intermittent test failures - unrelated service events could be captured,
   causing timeout errors when waiting for specific service events

Fix: Add try-finally block to ensure bundleContext.removeServiceListener()
is always called after the await completes, preventing listener accumulation
and cross-test event interference.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> 
The commit message should follow Conventional Commits. See https://www.conventionalcommits.org
Suggest: Commit message does not match the required pattern

@rishabhdaim rishabhdaim self-assigned this Jul 6, 2026
@rishabhdaim rishabhdaim changed the title OAK-12300: Remove ServiceListener after awaitServiceEvent completes OAK-12300 : Remove ServiceListener after awaitServiceEvent completes Jul 6, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant