Skip to content

Fix Windows script process handle leaks - #925

Open
wolph wants to merge 2 commits into
nzbgetcom:developfrom
wolph:codex/fix-script-process-handle-leak
Open

Fix Windows script process handle leaks#925
wolph wants to merge 2 commits into
nzbgetcom:developfrom
wolph:codex/fix-script-process-handle-leak

Conversation

@wolph

@wolph wolph commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Description

I noticed that nzbget was leaking more and more over time, so I had codex investigate and write up a fix.

I manually reviewed all of the code changes that codex made and they look good to me, but I'm not that familiar with the nzbget codebase yet so please let me know if I missed something.

AI assistance

  • This PR involved AI assistance (see AI Policy)

Lib changes

Testing

I've tested it for quite a while and I haven't had any leak issues since.

@wolph

wolph commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

If you want the fix to go in a different direction let me know too. I was pondering if it would be better to have the #ifdef WIN32 bit inside of the SetProcess so we can just call it from every bit of code and it would be a no-op for other platforms. The compiler should collapse it anyhow.

@dnzbk
dnzbk self-requested a review September 11, 2026 17:03
@dnzbk

dnzbk commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

@wolph The handle leak fix looks correct. One suggestion: use std::mutex + std::lock_guard instead of the custom Mutex/Guard - the custom ones are legacy.

@wolph

wolph commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

@wolph The handle leak fix looks correct. One suggestion: use std::mutex + std::lock_guard instead of the custom Mutex/Guard - the custom ones are legacy.

Done :)

My C++ is a bit rusty ;)

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.

2 participants