Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(155)

Issue 152130: net: remove race condition on Close. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 10 months ago by agl1
Modified:
15 years, 9 months ago
Reviewers:
rsc
CC:
golang-dev
Visibility:
Public.

Description

net: remove race condition on Close. Previously a netFd could be queued for reading/writing in the channel, but close(2)'ed before pollServer got to it. In this case, the kernel would consider the descriptor closed and the attempt to add it to the epoll set would fail and panic. This patch makes Close a roundtrip to the pollServer, although the actual close(2) still occurs elsewhere to avoid blocking the pollServer. Fixes issue 143.

Patch Set 1 #

Patch Set 2 : code review 152130: net: remove race condition on Close. #

Total comments: 1

Patch Set 3 : code review 152130: net: remove race condition on Close. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+31 lines, -16 lines) Patch
M src/pkg/net/fd.go View 1 2 8 chunks +31 lines, -16 lines 0 comments Download

Messages

Total messages: 4
agl1
15 years, 10 months ago (2009-11-13 23:36:16 UTC) #1
agl1
We chatted about also fixing the races in Read and Write. I've started looking at ...
15 years, 9 months ago (2009-11-17 19:27:09 UTC) #2
rsc
LGTM http://codereview.appspot.com/152130/diff/1001/1002 File src/pkg/net/fd.go (right): http://codereview.appspot.com/152130/diff/1001/1002#newcode121 src/pkg/net/fd.go:121: // Thus fd.fd mirrors the kernel's view of ...
15 years, 9 months ago (2009-11-18 07:02:48 UTC) #3
agl1
15 years, 9 months ago (2009-11-18 21:18:35 UTC) #4
*** Submitted as http://code.google.com/p/go/source/detail?r=ca5c1a5682f8 ***

net: remove race condition on Close.

Previously a netFd could be queued for reading/writing in the channel,
but close(2)'ed before pollServer got to it. In this case, the kernel
would consider the descriptor closed and the attempt to add it to the
epoll set would fail and panic.

This patch makes Close a roundtrip to the pollServer, although the
actual close(2) still occurs elsewhere to avoid blocking the
pollServer.

Fixes issue 143.

R=rsc
CC=golang-dev
http://codereview.appspot.com/152130

Committer: Adam Langley <agl@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b