Skip to content

Conversation

oncilla
Copy link
Contributor

@oncilla oncilla commented Jun 21, 2019

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 Reviewable

@oncilla oncilla added the BR label Jun 21, 2019
@oncilla oncilla added this to the Q2S3 milestone Jun 21, 2019
@oncilla oncilla requested a review from sgmonroy June 21, 2019 13:01
Copy link
Contributor

@kormat kormat left a 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.

Copy link
Contributor Author

@oncilla oncilla left a 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.

Copy link
Contributor

@kormat kormat left a 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)

@oncilla oncilla requested review from scrye and removed request for sgmonroy June 24, 2019 09:00
Copy link
Contributor

@scrye scrye left a 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.

oncilla added 3 commits June 25, 2019 09:04
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
Copy link
Contributor Author

@oncilla oncilla left a 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 with conn.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 like I or 1 or | in too many fonts, even the good console ones. Use n or c 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!

Copy link
Contributor

@scrye scrye left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r3.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@oncilla oncilla merged commit 9aa8213 into scionproto:master Jun 25, 2019
@oncilla oncilla deleted the pub-br-fix branch June 25, 2019 07:46
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.

BR: Packet leak on error BR: Continues to write on closed socket after topology reload
3 participants