Skip to content

Fix resource leaks: use try-with-resources and add cleanup hooks #1930

Merged
jnioche merged 1 commit into
mainfrom
resource-leaks
Jun 5, 2026
Merged

Fix resource leaks: use try-with-resources and add cleanup hooks #1930
jnioche merged 1 commit into
mainfrom
resource-leaks

Conversation

@dpol1
Copy link
Copy Markdown
Member

@dpol1 dpol1 commented Jun 4, 2026

Several resources were not properly closed, leading to potential leaks in
long-running crawl topologies.

  • RegexURLFilterBase: use try-with-resources for the classpath
    InputStream; add a null check when the resource file is not found
  • DebugParseFilter: add cleanup() override to close the output stream;
    add a proper SLF4J logger (replacing e.printStackTrace())
  • HttpProtocol (Playwright): wrap the page navigation block in a
    try/finally to ensure tracing is always stopped even when an exception
    is thrown, preventing a tracing resource leak

- RegexURLFilterBase: use try-with-resources for classpath InputStream;
  add null check when resource file is not found in classpath
- DebugParseFilter: add cleanup() override to close OutputStream; add
  SLF4J logger and replace e.printStackTrace()
- HttpProtocol (Playwright): add finally block to ensure tracing is
  always stopped even when an exception is thrown
@rzo1 rzo1 added this to the 3.6.1 milestone Jun 4, 2026
@dpol1 dpol1 requested a review from jnioche June 4, 2026 14:12
@jnioche jnioche merged commit 3a4d99a into main Jun 5, 2026
2 checks passed
@jnioche jnioche deleted the resource-leaks branch June 5, 2026 07:13
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.

3 participants