Skip to content
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

net: inconsistent error values #4856

Closed
dvyukov opened this issue Feb 20, 2013 · 23 comments
Closed

net: inconsistent error values #4856

dvyukov opened this issue Feb 20, 2013 · 23 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Feb 20, 2013

func (fd *netFD) Read(p []byte) (n int, err error) {
    ...
    if err := fd.incref(false); err != nil {
        return 0, err
    }
    ...
    if err != nil && err != io.EOF {
        err = &OpError{"read", fd.net, fd.raddr, err}
    }

Can return either errClosing or OpError depending on timings between Read and Close.

There are similar cases in other reads and writes.

And there are other inconsistencies, e.g. 
func Listen(net, laddr string) (Listener, error)
returns either UnknownNetworkError or &OpError{"listen", net, laddr,
otherError} or &OpError{"dial", net + " " + addr, nil,
UnknownNetworkError(net)}

I don't have a full list, just something I've noticed.
@rsc
Copy link
Contributor

rsc commented Mar 12, 2013

Comment 2:

[The time for maybe has passed.]

Labels changed: removed go1.1maybe.

@adg
Copy link
Contributor

adg commented Mar 22, 2013

Comment 3:

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 4:

Labels changed: added go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 5:

Labels changed: added feature.

@mikioh
Copy link
Contributor

mikioh commented Aug 13, 2013

Comment 6:

This issue was updated by revision 45cb2e1.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12763044

@mikioh
Copy link
Contributor

mikioh commented Aug 29, 2013

Comment 7:

This issue was updated by revision e4bb139.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/12916046

@mikioh
Copy link
Contributor

mikioh commented Aug 29, 2013

Comment 8:

I think I've done what I planned to do for Go 1.2.
In Go 1.3, we'll do the rest except controversial read/write stuff.
Then, wish someone makes it clear how to return io.EOF, errClosing on read/write ops.

Labels changed: added go1.3maybe, removed go1.2maybe.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 9:

Labels changed: removed feature.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 10:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 11:

Labels changed: added repo-main.

@mikioh
Copy link
Contributor

mikioh commented Apr 7, 2014

Comment 12:

This issue was updated by revision 3f5288c.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/84660046

@mikioh
Copy link
Contributor

mikioh commented Apr 7, 2014

Comment 13:

This issue was updated by revision a2a3514.

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/84800044

@gopherbot
Copy link

Comment 14:

CL https://golang.org/cl/84750043 references this issue.

@gopherbot
Copy link

Comment 15:

CL https://golang.org/cl/84750043 references this issue.

@gopherbot
Copy link

Comment 16:

CL https://golang.org/cl/85630044 mentions this issue.

@mikioh
Copy link
Contributor

mikioh commented May 2, 2014

Comment 17:

Labels changed: added release-go1.4, removed priority-later, release-none.

@rsc
Copy link
Contributor

rsc commented Sep 16, 2014

Comment 18:

Issue #7721 has been merged into this issue.

@rsc
Copy link
Contributor

rsc commented Sep 16, 2014

Comment 19:

See issue #7721 for test case to consider.

@rsc
Copy link
Contributor

rsc commented Sep 16, 2014

Comment 20:

Issue #7708 has been merged into this issue.

@rsc
Copy link
Contributor

rsc commented Sep 16, 2014

Comment 21:

And see issue #7708 for another.

@rsc
Copy link
Contributor

rsc commented Sep 16, 2014

Comment 22:

Seems too late for 1.4.

Labels changed: added release-go1.5, removed release-go1.4.

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014
mikioh pushed a commit that referenced this issue Jan 1, 2015
…n windows

Preventing returning io.EOF on non-connection oriented sockets is
already applied to Unix variants. This CL applies it to Windows.

Update #4856.

Change-Id: I82071d40f617e2962d0540b9d1d6a10ea4cdb2ec
Reviewed-on: https://go-review.googlesource.com/2203
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
@rsc rsc removed accepted labels Apr 14, 2015
mk0x9 pushed a commit to mk0x9/go that referenced this issue Apr 17, 2015
In followup changes, we'll move OpError around from the netFD layer to
the Conn layer for fixing golang#4856. Before doing that, this change makes
netFD of Plan 9 match netFD for POSIX platforms to avoid conflict.

Change-Id: Iea7632716d48722a1758e52effefec964a3a9442
Reviewed-on: https://go-review.googlesource.com/8990
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
mikioh pushed a commit that referenced this issue Apr 17, 2015
This change makes TestDialError, TestListenError work without any
external dependency, enables them by default, and removes unnecessary
-run_error_test flag for fixing #4856.

Also fixes inconsistent error values on Dial, Listen partially as a
first stab.

Updates #4856.

Change-Id: Ie10c151ae06759085f352c7db2ca45107a81914f
Reviewed-on: https://go-review.googlesource.com/8903
Reviewed-by: Ian Lance Taylor <iant@golang.org>
mk0x9 pushed a commit to mk0x9/go that referenced this issue Apr 18, 2015
This change fixes inconsistent error values on Read,
ReadFrom{,UDP,IP,Unix} and ReadMsg{UDP,IP,Unix}.

Updates golang#4856.

Change-Id: I7de5663094e09be2d78cdb18ce6f1e7ec260888d
Reviewed-on: https://go-review.googlesource.com/8992
Reviewed-by: Ian Lance Taylor <iant@golang.org>
mikioh pushed a commit that referenced this issue Apr 18, 2015
This change fixes inconsistent error values on Write,
WriteTo{,UDP,IP,Unix} and WriteMsg{UDP,IP,Unix}.

Updates #4856.

Change-Id: I4208ab6a0650455ad7d70a80a2d6169351d6055f
Reviewed-on: https://go-review.googlesource.com/8993
Reviewed-by: Ian Lance Taylor <iant@golang.org>
mikioh pushed a commit that referenced this issue Apr 18, 2015
This change fixes inconsistent error values on Close, CloseRead and
CloseWrite.

Updates #4856.

Change-Id: I3c4d46ccd7d6e1a2f52d8e75b512f62c533a368d
Reviewed-on: https://go-review.googlesource.com/8994
Reviewed-by: Ian Lance Taylor <iant@golang.org>
mikioh pushed a commit that referenced this issue Apr 18, 2015
This change fixes inconsistent error values on Accept{,TCP,Unix}.

Updates #4856.

Change-Id: Ie3bb534c19a724cacb3ea3f3656e46c810b2123f
Reviewed-on: https://go-review.googlesource.com/8996
Reviewed-by: Ian Lance Taylor <iant@golang.org>
mikioh pushed a commit that referenced this issue Apr 21, 2015
This change fixes inconsistent error values on
File{Conn,Listener,PacketConn} and File method of Conn, Listener.

Updates #4856.

Change-Id: I3197b9277bef0e034427e3a44fa77523acaa2520
Reviewed-on: https://go-review.googlesource.com/9101
Reviewed-by: Ian Lance Taylor <iant@golang.org>
mikioh pushed a commit that referenced this issue Apr 21, 2015
This change fixes inconsistent error values on
Set{Deadline,ReadDeadline,WriteDeadline,ReadBuffer,WriteBuffer} for
Conn, Listener and PacketConn, and
Set{KeepAlive,KeepAlivePeriod,Linger,NoDelay} for TCPConn.

Updates #4856.

Change-Id: I34ca5e98f6de72863f85b2527478b20d8d5394dd
Reviewed-on: https://go-review.googlesource.com/9109
Reviewed-by: Ian Lance Taylor <iant@golang.org>
mikioh pushed a commit that referenced this issue Apr 21, 2015
This change fixes inconsistent error values on Interfaces,
InterfaceAddrs, InterfaceBy{Index,Name}, and Addrs and MulticastAddrs
methods of Interface.

Updates #4856.

Change-Id: I09e65522a22f45c641792d774ebf7a0081b874ad
Reviewed-on: https://go-review.googlesource.com/9140
Reviewed-by: Ian Lance Taylor <iant@golang.org>
mikioh pushed a commit that referenced this issue Apr 21, 2015
This change fixes inconsistent error values on
Lookup{Addr,CNAME,Host,IP.MX,NS,Port,SRV,TXT}.

Updates #4856.

Change-Id: I059bc8ffb96ee74dff8a8c4e8e6ae3e4a462a7ef
Reviewed-on: https://go-review.googlesource.com/9108
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/9231 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/9236 mentions this issue.

mikioh pushed a commit that referenced this issue Apr 29, 2015
Not only by network, transport-layer intermediaries but by
virtualization stuff in a node, it is hard to identify the root cause of
weird faults without information of packet flows after disaster
happened.

This change adds Source field to OpError to be able to represent a
5-tuple of internet transport protocols for helping dealing with
complicated systems.

Also clarifies the usage of Source and Addr fields.

Updates #4856.

Change-Id: I96a523fe391ed14406bfb21604c461d4aac2fa19
Reviewed-on: https://go-review.googlesource.com/9231
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@mikioh mikioh closed this as completed in 055ecb7 May 5, 2015
mikioh pushed a commit that referenced this issue May 6, 2015
Updates #4856.

Change-Id: Ia04e24fb1fe57e244d7b1cd417f7f419ad610acd
Reviewed-on: https://go-review.googlesource.com/9776
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
@golang golang locked and limited conversation to collaborators Jun 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants