Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ jobs:
terraform_wrapper: false

- name: Test with Mock Database
env:
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
-covermode=atomic -coverprofile="gotests.coverage" -failfast
-timeout=3m -count=5 -race -short

- name: Upload DataDog Trace
if: (success() || failure()) && github.actor != 'dependabot[bot]'
Expand All @@ -166,7 +168,7 @@ 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]'
Expand Down
4 changes: 2 additions & 2 deletions coderd/coderdtest/coderdtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func AwaitProjectImportJob(t *testing.T, client *codersdk.Client, organization s
provisionerJob, err = client.ProjectImportJob(context.Background(), organization, job)
require.NoError(t, err)
return provisionerJob.Status.Completed()
}, 3*time.Second, 25*time.Millisecond)
}, 5*time.Second, 25*time.Millisecond)
return provisionerJob
}

Expand All @@ -169,7 +169,7 @@ func AwaitWorkspaceProvisionJob(t *testing.T, client *codersdk.Client, organizat
provisionerJob, err = client.WorkspaceProvisionJob(context.Background(), organization, job)
require.NoError(t, err)
return provisionerJob.Status.Completed()
}, 3*time.Second, 25*time.Millisecond)
}, 5*time.Second, 25*time.Millisecond)
return provisionerJob
}

Expand Down
4 changes: 4 additions & 0 deletions coderd/provisionerdaemons.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ func (api *api) provisionerDaemonsServe(rw http.ResponseWriter, r *http.Request)
_ = conn.Close(websocket.StatusInternalError, fmt.Sprintf("multiplex server: %s", err))
return
}
go func() {
<-r.Context().Done()
_, _ = fmt.Printf("\n\n\n\nDONE\n\n\n\n")
}()
mux := drpcmux.New()
err = proto.DRPCRegisterProvisionerDaemon(mux, &provisionerdServer{
ID: daemon.ID,
Expand Down
3 changes: 3 additions & 0 deletions provisionerd/provisionerd.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,13 @@ func (p *provisionerDaemon) connect(ctx context.Context) {
if errors.Is(err, context.Canceled) {
return
}
p.closeMutex.Lock()
if p.isClosed() {
p.closeMutex.Unlock()
return
}
p.opts.Logger.Warn(context.Background(), "failed to dial", slog.Error(err))
p.closeMutex.Unlock()
continue
}
p.opts.Logger.Debug(context.Background(), "connected")
Expand Down