Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x.x] Fix an issue where XQuery Trigger state may leak #5483

Merged

Conversation

adamretter
Copy link
Contributor

@adamretter adamretter commented Oct 8, 2024

Backport of #5481

NOTE: Needs #5468 merged first and then this needs to be rebased

@adamretter adamretter added the bug issue confirmed as bug label Oct 8, 2024
@adamretter adamretter added this to the eXist-4.11.1 milestone Oct 8, 2024
@dizzzz
Copy link
Member

dizzzz commented Oct 10, 2024

all builds fail...

@adamretter
Copy link
Contributor Author

all builds fail...

Yes, this needs #5468 first

@dizzzz
Copy link
Member

dizzzz commented Oct 10, 2024

#5468 is in.... (since a minute)

XQuery trigger not found is acceptable behaviour (logs a debug message only, could get very chatty logs otherwise).
BUT the exit path from the exception fails to tidy up the per-thread trigger state. This has been observed to leak memory; the per-thread doesn’t get cleaned up until the thread is deleted, and the trigger cyclic-check stack just builds up.

So we clean up the trigger state when a trigger is not found.

Closes eXist-db#5459
We may leak trigger states to thread local which can potentially occur when
the specified XQueryTrigger library module is not available in the database

Closes eXist-db#5459
@adamretter adamretter force-pushed the 4.x.x/hotfix/xquery-trigger-leak branch from 6e4286a to bdb703f Compare October 10, 2024 12:04
@adamretter
Copy link
Contributor Author

#5468 is in.... (since a minute)

@dizzzz Thanks :-) Okay I have rebased it, let's see what CI says...

@adamretter
Copy link
Contributor Author

@dizzzz The 1 flaky test failure on Windows in CI for AllStorageTests occurs because StoreResourceTest.checkAttributes seems to believe that updating a document takes less than 1ms occasionally. I have appended a commit that should address that.

@reinhapa reinhapa merged commit f1dd48b into eXist-db:develop-4.x.x Oct 10, 2024
4 checks passed
@adamretter adamretter deleted the 4.x.x/hotfix/xquery-trigger-leak branch November 29, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue confirmed as bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants