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

fix: Leaking yamux session after HTTP handler is closed #326

Closed
wants to merge 6 commits into from

Conversation

kylecarbs
Copy link
Member

Closes #317. We depended on the context canceling the yamux connection,
but this isn't a sync operation. Explicitly calling close ensures the
handler waits for yamux to complete before exit.

Closes #317. We depended on the context canceling the yamux connection,
but this isn't a sync operation. Explicitly calling close ensures the
handler waits for yamux to complete before exit.
@kylecarbs kylecarbs self-assigned this Feb 18, 2022
Comment on lines 87 to 89
defer func() {
_ = session.Close()
}()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Nice find @kylecarbs 🎉 This looks like it should fix some of those goleaks that are picked up after the test runs.

@codecov
Copy link

codecov bot commented Feb 18, 2022

Codecov Report

Merging #326 (94e03a2) into main (5ef59e7) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #326   +/-   ##
=======================================
  Coverage   63.61%   63.61%           
=======================================
  Files          69       69           
  Lines         786      786           
  Branches       77       77           
=======================================
  Hits          500      500           
  Misses        271      271           
  Partials       15       15           
Flag Coverage Δ
unittest-js 63.61% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5ef59e7...94e03a2. Read the comment docs.

@kylecarbs
Copy link
Member Author

Still happened after this change. I believe I understand why though, and am working on a fix:

https://github.com/coder/coder/runs/5251190813?check_suite_focus=true#step:7:45

@kylecarbs kylecarbs force-pushed the closeconn branch 4 times, most recently from ca2202d to eaf3a37 Compare February 18, 2022 21:19
@kylecarbs kylecarbs closed this Feb 18, 2022
@kylecarbs kylecarbs deleted the closeconn branch February 18, 2022 22:24
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.

Fix websocket/yamux/drpc goleak failure on Windows
2 participants