Skip to content

Refactor port forward manager cleanup lifecycle#5342

Open
pappz wants to merge 1 commit intonat-pmp-upnpfrom
fix/nat-pmp-upnp-locks
Open

Refactor port forward manager cleanup lifecycle#5342
pappz wants to merge 1 commit intonat-pmp-upnpfrom
fix/nat-pmp-upnp-locks

Conversation

@pappz
Copy link
Contributor

@pappz pappz commented Feb 16, 2026

Replace async goroutine-based cleanup with a synchronous flow where Start runs cleanup inline after renewLoop exits. Use a stopCtx channel so GracefullyStop can pass its deadline-bounded context to Start's cleanup path. When no graceful stop occurs, Start fires cleanup in a background goroutine with a 10s timeout.

Also fix GetMapping double Lock, renewMapping referencing undefined m.mu, cleanup referencing undefined variables, remove statemanager dependency

Describe your changes

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Replace async goroutine-based cleanup with a synchronous flow where
Start runs cleanup inline after renewLoop exits. Use a stopCtx channel
so GracefullyStop can pass its deadline-bounded context to Start's
cleanup path. When no graceful stop occurs, Start fires cleanup in a
background goroutine with a 10s timeout.

Also fix GetMapping double Lock, renewMapping referencing undefined m.mu,
cleanup referencing undefined variables, remove statemanager dependency,
and align manager_js.go stub signatures.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/nat-pmp-upnp-locks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link

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