Comments (5)
Thanks for reporting. Changing the type of gotGSOError
to atomic.Bool
is probably not the correct solution though, as it just masks the underlying race condition.
from quic-go.
Actual data race happens when accessing sconn.gotGSOError. Changing its' type to atomic.Bool
solves the problem. I suspect wroteFirstPacket
field may cause the same issue as it can also be edited by different goroutines simultaniously. But I did not dig deep into more details whether doing that would be a good enough solution. Please let me know if it would and I could create a PR
from quic-go.
Affected as well (I initially thought it was a data race like #4303 - however even when disabling 0-RTT, the data race appears sometime).
as it just masks the underlying race condition
I have run it a couple of times with a simple test of mine and apparently the GSOError does not appear on the first write (in the following example it appears on the 7th):
> 1x: gotGSOError false (send_conn.go:97)
> 6x: writePacket error nil (send_conn.go:63)
> 2x: gotGSOError false (send_conn.go:97)
> 1x: gotGSOError false (send_conn.go:97)
> 1x: writePacket error(*net.OpError) (send_conn.go:63) <- this is a GSOError
With such an execution trace, I see two possible solutions:
- make
c.gotGSOError
atomic or mutex protected - adjust client.go:467
connState := conn.ConnectionState().TLS
since this triggers the data race, but does not care about the GSO capability (it access the variable withinConnectionState()
, but only takes theTLS
field). For instance theConnectionState
method could be split:
type Connection interface {
// ...
// ConnectionState returns information about the TLS connection state
ConnectionState() tls.ConnectionState
// QuicState returns basic details about the QUIC connection.
// Warning: This API should not be considered stable and might change soon.
QuicState() QuicState
// ...
}
I would be willing to draft a PR to address this.
from quic-go.
as it just masks the underlying race condition
I have run it a couple of times with a simple test of mine and apparently the GSOError does not appear on the first write (in the following example it appears on the 7th):
Interesting! What system are you running on?
- adjust client.go:467
connState := conn.ConnectionState().TLS
since this triggers the data race, but does not care about the GSO capability (it access the variable withinConnectionState()
, but only takes theTLS
field). For instance theConnectionState
method could be split:
This wouldn't solve the race, it would just hide it, right?
from quic-go.
What system are you running on?
Arch Linux.
Investigating a bit more, the GSOError happens at the first GSO packet (which is the 7th). The first 6 packets have gsoSize
set to 0 (during which handshakeConfirmed
is false).
adjust client.go:467 connState := conn.ConnectionState().TLS since this triggers the data race, but does not care about the GSO capability (it access the variable within ConnectionState(), but only takes the TLS field). For instance the ConnectionState method could be split:
This wouldn't solve the race, it would just hide it, right?
I think this would solve the race because it happens during the dial
phase, before the connection
is returned to the caller.
So nothing outside of the library should be able to call ConnectionState
before the GSOError
value is settled (except if you want to handle GSO being disabled during a connection, in which case I don't see any solution without a mutex).
from quic-go.
Related Issues (20)
- quic-go.newStream high memory usage HOT 7
- http3: response body not implemented http3.HTTPStreamer HOT 9
- Datagram no recent network activity error HOT 3
- bug: unable to connect to quiche servers HOT 5
- In some cases I have turned off Stream on the server side, but OpenStreamSync on the client side is still blocked HOT 6
- pass a context to ConnContext context, cancel it when the connection is closed
- Slow transfer speed HOT 10
- Wrong ACK numbers? HOT 1
- gquic branch usage HOT 1
- Go 1.21
- server incorrectly allows 0-RTT with reduced limits when using tls.Config.GetConfigForClient
- introduce a minimum step size of Path MTU Discovery
- Allow applications to specify MaxPacketBufferSize HOT 7
- add more metrics
- Significant Packet Delay with quic-go on iOS Due to Goroutine Handling HOT 3
- http3: RoundTripper is caching dialErr since v0.43.0 HOT 1
- Cancel retransmission of data when sending with quic Client HOT 1
- implement BBRv3 HOT 2
- use `net.ErrClosed` for the server and the connection
- [Suggestion] multi-staging build in quic-go example Dockerfile HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quic-go.