-
Notifications
You must be signed in to change notification settings - Fork 350
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: exit when FUSE errors on accept #2257
Conversation
73a065c
to
c44e59d
Compare
c44e59d
to
ebb71af
Compare
internal/proxy/proxy_other.go
Outdated
<-ctx.Done() | ||
return ctx.Err() | ||
select { | ||
case cErr := <-c.fuseExitCh: |
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.
nit: since there are no other errors in scope here, err
would be fine here.
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.
Updated to reuse err
.
conn := tryDialUnix(t, socketPath) | ||
defer conn.Close() | ||
|
||
var got []string |
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.
Is this block of assertions necessary? tryDialUnix should wait until a connection has been established and we have tests elsewhere that ensure the wiring is correct (see above for example).
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.
I removed the d.dialedInstances()
assertion.
internal/proxy/fuse_test.go
Outdated
servErrCh := make(chan error) | ||
go func() { | ||
servErr := c.Serve(context.Background(), func() { close(ready) }) | ||
servErrCh <- servErr |
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.
This will leak goroutines if servErrCh is full.
How about:
select {
case servErrCh <- servErr:
default:
// exit background thread
}
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.
Fixed.
5ef7f29
to
a46c983
Compare
internal/proxy/fuse_test.go
Outdated
go c.Serve(context.Background(), func() { close(ready) }) | ||
servErrCh := make(chan error) | ||
go func() { | ||
servErr := c.Serve(context.Background(), func() { close(ready) }) |
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.
My suggestion seems to have broken your test. Maybe it's better to block on the error channel or a context that you can cancel at the end of the test run.
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.
There must be some subtle timing difference in the ubuntu implementation of channels. I put the test back to how it was and now it passes. I think its OK for this goroutine to block until servErrCh
can accept an error.
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.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
go func() {
servErr := c.Server(ctx, func() { close(ready) })
select {
case servErrCh <- serrErr:
case <-ctx.Done():
}
}()
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.
Fixed.
3b2b3b5
to
1584076
Compare
1584076
to
14352f8
Compare
|
||
ctx, cancel := context.WithCancel(context.Background()) | ||
go func() { | ||
|
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.
nit: whitespace
This change makes FUSE-configured connections behave the same way as normal connections:
the proxy process should exit when there is an error accepting a connection while listening on
the local server socket.
Fixes #2256