-
Notifications
You must be signed in to change notification settings - Fork 173
BR: Fix packet leak and write on closed socket #2789
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
Conversation
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.
Reviewed 1 of 8 files at r1.
Reviewable status: 1 of 8 files reviewed, 3 unresolved discussions (waiting on @oncilla and @sgmonroy)
go/border/io.go, line 238 at r1 (raw file):
} // Before dropping the packets, we have to return them to the freelist. releaseAllPkts(epkts[:toWrite])
releasePkts
would be clearer to me. All
sounds like it's not getting a subset of packets.
go/border/io.go, line 239 at r1 (raw file):
// Before dropping the packets, we have to return them to the freelist. releaseAllPkts(epkts[:toWrite]) // Drop packets attempted to write.
"Drop packets from the failed write attempt" maybe.
go/border/io.go, line 322 at r1 (raw file):
} // releaseAllPkts releases all pkts in the entry list.
I'd put this before shiftUnwrittenPkts
as it should be called before it.
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.
Reviewable status: 1 of 8 files reviewed, 3 unresolved discussions (waiting on @kormat and @sgmonroy)
go/border/io.go, line 238 at r1 (raw file):
Previously, kormat (Stephen Shirley) wrote…
releasePkts
would be clearer to me.All
sounds like it's not getting a subset of packets.
Done.
go/border/io.go, line 239 at r1 (raw file):
Previously, kormat (Stephen Shirley) wrote…
"Drop packets from the failed write attempt" maybe.
Done.
go/border/io.go, line 322 at r1 (raw file):
Previously, kormat (Stephen Shirley) wrote…
I'd put this before
shiftUnwrittenPkts
as it should be called before it.
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.
Reviewed 1 of 8 files at r1, 1 of 1 files at r2.
Reviewable status: 2 of 8 files reviewed, all discussions resolved (waiting on @sgmonroy)
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.
Reviewed 6 of 8 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @oncilla)
go/border/io_test.go, line 116 at r2 (raw file):
} func testSuccessfulWrite(done chan<- struct{}) func(msgsI interface{}) (int, error) {
Any reason for the interface{}
argument? Gomock's reflection allows for explicit types in there, and will work correctly with conn.Messages
.
go/border/io_test.go, line 127 at r2 (raw file):
} func testConn(mctrl *gomock.Controller) *mock_conn.MockConn {
I'd prefer newTestConn
, it feels more Go-ish for object construction.
go/border/io_test.go, line 136 at r2 (raw file):
} func testPktList(t *testing.T, l int) (ringbuf.EntryList, func(expected int)) {
Rename l
, it's one of the most awkward one letter vars because it looks too much like I
or 1
or |
in too many fonts, even the good console ones. Use n
or c
instead.
go/border/io_test.go, line 163 at r2 (raw file):
func testSock(r *Router, ringSize int, mconn conn.Conn) *rctx.Sock { return rctx.NewSock(ringbuf.New(ringSize, nil, "locOut", prometheus.Labels{"ringId": "posixOutput"}), mconn, 0, 12,
So many concrete dependencies in test code that has nothing to do with them makes me sad :(. But there's no easy way around this.
This pull request fixes the packet leak in the posixOutput go routine. In case of an non-temporary error, the packets are not returned to the free list. Additionally, it fixes the issue where the posixOutput go routine continues to write on a closed socket. fixes scionproto#2788 fixes scionproto#2774
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.
Reviewable status: 7 of 8 files reviewed, 3 unresolved discussions (waiting on @scrye)
go/border/io_test.go, line 116 at r2 (raw file):
Previously, scrye (Sergiu Costea) wrote…
Any reason for the
interface{}
argument? Gomock's reflection allows for explicit types in there, and will work correctly withconn.Messages
.
I never realized.
Done.
go/border/io_test.go, line 127 at r2 (raw file):
Previously, scrye (Sergiu Costea) wrote…
I'd prefer
newTestConn
, it feels more Go-ish for object construction.
Done.
go/border/io_test.go, line 136 at r2 (raw file):
Previously, scrye (Sergiu Costea) wrote…
Rename
l
, it's one of the most awkward one letter vars because it looks too much likeI
or1
or|
in too many fonts, even the good console ones. Usen
orc
instead.
Done.
go/border/io_test.go, line 163 at r2 (raw file):
Previously, scrye (Sergiu Costea) wrote…
So many concrete dependencies in test code that has nothing to do with them makes me sad :(. But there's no easy way around this.
I feel your pain, believe me!
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.
Reviewed 1 of 1 files at r3.
Reviewable status:complete! all files reviewed, all discussions resolved
This pull request fixes the packet leak in the posixOutput go routine.
In case of an non-temporary error, the packets are not returned to the
free list.
Additionally, it fixes the issue where the posixOutput go routine
continues to write on a closed socket.
fixes #2788
fixes #2774
This change is