You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/10/09 15:07:42 UTC
[GitHub] [dubbo-getty] AlexStocks opened a new issue #77: Bug: maybe can not read the last tcp package
AlexStocks opened a new issue #77:
URL: https://github.com/apache/dubbo-getty/issues/77
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
-->
**What happened**:
![image](https://user-images.githubusercontent.com/7959374/136663410-c3228892-14ed-45a2-b54a-633dd3a2c77f.png)
![image](https://user-images.githubusercontent.com/7959374/136663427-34e5d07e-893b-4bff-a368-b80f7f9fc920.png)
![image](https://user-images.githubusercontent.com/7959374/136663398-b8738530-3880-44aa-8140-4857a2a793d3.png)
![image](https://user-images.githubusercontent.com/7959374/136663454-1eef5f68-f977-4ecd-9d7d-22e7aeda7959.png)
when read the last tcp packageļ¼the return value of Read is "pkgLen, eof". So we should process the last package before considering the error.
However, getty just handle the error and then exit without processing the last package.
**What you expected to happen**:
Getty processes the last the package before handling the error.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-getty] AlexStocks commented on issue #77: Bug: maybe can not read the last tcp package
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on issue #77:
URL: https://github.com/apache/dubbo-getty/issues/77#issuecomment-939652203
as internal/poll/fd_posix.go fd.eofError shows, when got eof error, the tcp stream buffer length is zero. So this issue is not valid.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-getty] AlexStocks edited a comment on issue #77: Bug: maybe can not read the last tcp package
Posted by GitBox <gi...@apache.org>.
AlexStocks edited a comment on issue #77:
URL: https://github.com/apache/dubbo-getty/issues/77#issuecomment-939652203
as internal/poll/fd_posix.go fd.eofError shows, when got eof error, the tcp stream buffer length is zero. So this issue is not valid.
What's more, even if the return value "len != 0, error == eof", we will get "len == 0, error == eof" if we continue to read the closed socket as the following examples.
1. firstly, we start a nc tcp server.
```
nc -lk 127.0.0.1 20000
```
2. start a go client.
```go
package main
import (
"log"
"net"
"os"
"time"
)
func main() {
conn, err := net.Dial("tcp", "127.0.0.1:20000")
if err != nil {
log.Println("dial failed:", err)
os.Exit(1)
}
defer conn.Close()
buffer := make([]byte, 512)
for {
conn.SetReadDeadline(time.Now().Add(1 * time.Second))
n, err := conn.Read(buffer)
if err != nil {
log.Println("Read failed:", err)
// return
} else {
log.Println("count:", n, "msg:", string(buffer))
}
time.Sleep(3e9)
}
}
```
3. After start the go client successfully, close the nc tcp server.
4. The output of the go tcp client is as follows.
```bash
go run a.go
2021/10/11 12:06:20 Read failed: read tcp 127.0.0.1:63465->127.0.0.1:20000: i/o timeout
2021/10/11 12:06:23 count: 4 msg: fff
2021/10/11 12:06:26 count: 6 msg: hello
2021/10/11 12:06:29 count: 9 msg: lalalaal
2021/10/11 12:06:32 Read failed: EOF
2021/10/11 12:06:35 Read failed: EOF
2021/10/11 12:06:38 Read failed: EOF
2021/10/11 12:06:41 Read failed: EOF
2021/10/11 12:06:44 Read failed: EOF
2021/10/11 12:06:47 Read failed: EOF
2021/10/11 12:06:50 Read failed: EOF
2021/10/11 12:06:53 Read failed: EOF
2021/10/11 12:06:56 Read failed: EOF
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-getty] AlexStocks closed issue #77: Bug: maybe can not read the last tcp package
Posted by GitBox <gi...@apache.org>.
AlexStocks closed issue #77:
URL: https://github.com/apache/dubbo-getty/issues/77
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-getty] AlexStocks edited a comment on issue #77: Bug: maybe can not read the last tcp package
Posted by GitBox <gi...@apache.org>.
AlexStocks edited a comment on issue #77:
URL: https://github.com/apache/dubbo-getty/issues/77#issuecomment-939652203
as internal/poll/fd_posix.go fd.eofError shows, when got eof error, the tcp stream buffer length is zero. So this issue is not valid.
What's more, even if the return value "len != 0, error == eof", we will get "len == 0, error == eof" if we continue to read the closed socket as the following examples.
1. firstly, we start a nc tcp server.
```
nc -lk 127.0.0.1 20000
```
2. start a go client.
```go
package main
import (
"log"
"net"
"os"
"time"
)
func main() {
conn, err := net.Dial("tcp", "127.0.0.1:20000")
if err != nil {
log.Println("dial failed:", err)
os.Exit(1)
}
defer conn.Close()
buffer := make([]byte, 512)
for {
conn.SetReadDeadline(time.Now().Add(1 * time.Second))
n, err := conn.Read(buffer)
if err != nil {
log.Println("Read failed, error:", err, ", count: ", n)
// return
} else {
log.Println("count:", n, "msg:", string(buffer))
}
time.Sleep(3e9)
}
}
```
3. After start the go client successfully, close the nc tcp server.
4. The output of the go tcp client is as follows.
![image](https://user-images.githubusercontent.com/7959374/143884767-f4f7ed99-e5ec-4c02-95a2-5c7089067a09.png)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org