Is this a possible bug with pipe

156 views
Skip to first unread message

Ramki...@hotmail.com

unread,
Sep 12, 2022, 5:15:50 PM9/12/22
to golang-nuts
I created a TCP Proxy using io.copy (which creates a splice). Here is the code.

Proxy TCP Server - https://pastebin.com/iAcFjmV1
Regular TCP Server - https://pastebin.com/V6AN7atV

When using telent to port 8080, the proxy starts and everything typed in the telnet will be returned. After 10 seconds, the connection drop to the proxy but you can see there is one message/packet lost.


You can see that the proxy ends at the end of when 0 is used in Telnet. 's' is then sent from the Telnet but it's not seen in the proxy.go as shown in the screenshot. 'd' 'f' etc are then seen in the proxy.go.

's' is lost. Is this a bug?

Jan Mercl

unread,
Sep 12, 2022, 5:26:21 PM9/12/22
to Ramki...@hotmail.com, golang-nuts
I think it is - in using io.copy for this job. It's stream oriented
and does not understand packet boundaries. Meaning it can block while
buffering in the middle of a packet, disrupting any handshaking
protocol.

Ramki...@hotmail.com

unread,
Sep 14, 2022, 7:53:21 PM9/14/22
to golang-nuts
When I submitted it as a bug, this is what I got.  https://github.com/golang/go/issues/55029 By chance, do you know what is a  buffering for io.Copy?

Jan Mercl

unread,
Sep 14, 2022, 8:10:15 PM9/14/22
to Ramki...@hotmail.com, golang-nuts
On Thu, Sep 15, 2022 at 1:53 AM Ramki...@hotmail.com
<Ramki...@hotmail.com> wrote:

> When I submitted it as a bug, this is what I got. https://github.com/golang/go/issues/55029 By chance, do you know what is a buffering for io.Copy?

https://cs.opensource.google/go/go/+/refs/tags/go1.19.1:src/io/io.go;l=385
Reply all
Reply to author
Forward
0 new messages