-
Notifications
You must be signed in to change notification settings - Fork 888
fix: Leaking yamux session after HTTP handler is closed #329
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,7 +122,7 @@ jobs: | |
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
- windows-2022 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
|
@@ -138,9 +138,9 @@ jobs: | |
~/.cache/go-build | ||
~/Library/Caches/go-build | ||
%LocalAppData%\go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
key: ${{ matrix.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
${{ matrix.os }}-go- | ||
|
||
- run: go install gotest.tools/gotestsum@latest | ||
|
||
|
@@ -150,9 +150,13 @@ jobs: | |
terraform_wrapper: false | ||
|
||
- name: Test with Mock Database | ||
shell: bash | ||
env: | ||
GOCOUNT: ${{ runner.os == 'Windows' && 3 || 5 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice addition 👍 |
||
GOMAXPROCS: ${{ runner.os == 'Windows' && 1 || 2 }} | ||
run: gotestsum --junitfile="gotests.xml" --packages="./..." -- | ||
-covermode=atomic -coverprofile="gotests.coverage" | ||
-timeout=3m -count=5 -race -short -parallel=2 | ||
-timeout=3m -count=$GOCOUNT -race -short -failfast | ||
|
||
- name: Upload DataDog Trace | ||
if: (success() || failure()) && github.actor != 'dependabot[bot]' | ||
|
@@ -166,10 +170,10 @@ jobs: | |
if: runner.os == 'Linux' | ||
run: DB=true gotestsum --junitfile="gotests.xml" --packages="./..." -- | ||
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m | ||
-count=1 -race -parallel=2 | ||
-count=1 -race -parallel=2 -failfast | ||
|
||
- name: Upload DataDog Trace | ||
if: (success() || failure()) && github.actor != 'dependabot[bot]' | ||
if: (success() || failure()) && github.actor != 'dependabot[bot]' && runner.os == 'Linux' | ||
env: | ||
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} | ||
DD_DATABASE: postgresql | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import ( | |
"context" | ||
"database/sql" | ||
"io" | ||
"net" | ||
"net/http/httptest" | ||
"net/url" | ||
"os" | ||
|
@@ -59,7 +60,13 @@ func New(t *testing.T) *codersdk.Client { | |
Database: db, | ||
Pubsub: pubsub, | ||
}) | ||
srv := httptest.NewServer(handler) | ||
srv := httptest.NewUnstartedServer(handler) | ||
srv.Config.BaseContext = func(_ net.Listener) context.Context { | ||
ctx, cancelFunc := context.WithCancel(context.Background()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch... It's surprising that this is necessary, but glad you found it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It genuinely amazed me. |
||
t.Cleanup(cancelFunc) | ||
return ctx | ||
} | ||
srv.Start() | ||
serverURL, err := url.Parse(srv.URL) | ||
require.NoError(t, err) | ||
t.Cleanup(srv.Close) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per our discussion in slack - we may want to consider bumping the cache in one of these ways:
-v0-
parameter that we can bump to invalidate the cachematrix.os
instead ofrunner.os
for the cache here - that will usewindows-2022
instead ofwindows
for the cache keyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh that's a great idea! Changing now.