-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.arch-wasmWebAssembly issuesWebAssembly issues
Milestone
Description
Does this issue reproduce with the latest release?
Yes
What did you do?
Tried to write a test that checks whether a net.Conn is already closed by checking that calling Close returns an error and run it on wasm. See
go/src/crypto/tls/handshake_server_test.go
Lines 1980 to 1982 in 5d5f779
| if runtime.GOARCH == "wasm" { | |
| t.Skip("conn.Close does not error as expected when called multiple times on WASM") | |
| } |
What did you expect to see?
An error suggesting that the connection has already been closed, as is consistent with all other architectures tested.
What did you see instead?
No error.
Discussion
I think the offending code is here:
Lines 110 to 115 in 5d5f779
| func (fd *netFD) Close() error { | |
| fd.closedMu.Lock() | |
| if fd.closed { | |
| fd.closedMu.Unlock() | |
| return nil | |
| } |
On unix platforms the behaviour is to return internal/poll.ErrNetClosing or internal/pool.ErrFileClosing:
go/src/internal/poll/fd_unix.go
Lines 93 to 96 in 5d5f779
| func (fd *FD) Close() error { | |
| if !fd.fdmu.increfAndClose() { | |
| return errClosing(fd.isFile) | |
| } |
Lines 42 to 47 in 5d5f779
| func errClosing(isFile bool) error { | |
| if isFile { | |
| return ErrFileClosing | |
| } | |
| return ErrNetClosing | |
| } |
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.arch-wasmWebAssembly issuesWebAssembly issues