moguchev commented on issue #1919:
URL:
https://github.com/apache/cassandra-gocql-driver/issues/1919#issuecomment-3586780056
May be problem somewhere here:
```go
func (c *Conn) processFrame(ctx context.Context, r io.Reader) error {
// not safe for concurrent reads
// read a full header, ignore timeouts, as this is being ran in a loop
// TODO: TCP level deadlines? or just query level deadlines?
if c.r.GetTimeout() > 0 {
c.r.SetReadDeadline(time.Time{}) //nolint:errcheck
}
headStartTime := time.Now()
// were just reading headers over and over and copy bodies
head, err := readHeader(r, c.headerBuf[:])
headEndTime := time.Now()
if err != nil {
return err // here we get error i/o timeout
}
```
We set no timeout `c.r.SetReadDeadline(time.Time{})` to read a full header,
ignore timeouts. But `readHeader` call `io.ReadFull(c.r)` which calls `(c
*connReader) Read`:
```go
func (c *connReader) Read(p []byte) (n int, err error) {
const maxAttempts = 5
for i := 0; i < maxAttempts; i++ {
var nn int
if c.timeout > 0 {
c.conn.SetReadDeadline(time.Now().Add(c.timeout))
//nolint:errcheck
}
nn, err = io.ReadFull(c.r, p[n:])
n += nn
if err == nil {
break
}
if verr, ok := err.(net.Error); !ok || !verr.Temporary() {
//nolint:staticcheck
break
}
}
return
}
```
`connReader.timeout` is not zero so we `SetReadDeadline` again...
May be it's ok logic now, I don't know...
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]