-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
race condition #2533
Comments
I think this is caused by a double free by diff --git a/frame_sorter_test.go b/frame_sorter_test.go
index de20bf2d..71ad0e45 100644
--- a/frame_sorter_test.go
+++ b/frame_sorter_test.go
@@ -2,6 +2,7 @@ package quic
import (
"bytes"
+ "reflect"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/utils"
@@ -167,6 +168,35 @@ var _ = Describe("frame sorter", func() {
})
})
+ It("callback is inserted to two offsets", func() {
+ // make sure frames are not cut when we overlap a little bit
+ Expect(protocol.MinStreamFrameBufferSize).To(BeNumerically("<", 500/2))
+ initialCb1, _ := getCallback()
+ initialCb2, _ := getCallback()
+ Expect(s.Push(bytes.Repeat([]byte{1}, 100), 900, initialCb1)).To(Succeed())
+ Expect(s.Push(bytes.Repeat([]byte{1}, 400), 500, initialCb2)).To(Succeed())
+ Expect(s.queue).To(HaveKey(protocol.ByteCount(900)))
+ Expect(s.queue).To(HaveKey(protocol.ByteCount(500)))
+ checkGaps([]utils.ByteInterval{
+ {Start: 0, End: 500},
+ {Start: 1000, End: protocol.MaxByteCount},
+ })
+
+ cb, _ := getCallback()
+ // 900 to 1400
+ Expect(s.Push(bytes.Repeat([]byte{9}, 500), 900, cb)).To(Succeed())
+ Expect(s.queue).To(HaveKey(protocol.ByteCount(900)))
+ Expect(s.queue[900].Data).To(Equal(bytes.Repeat([]byte{9}, 500))) // 900 to 1400
+ checkGaps([]utils.ByteInterval{
+ {Start: 0, End: 500},
+ {Start: 1400, End: protocol.MaxByteCount},
+ })
+
+ // Test that the callback is inserted to two offsets
+ Expect(reflect.ValueOf(s.queue[900].DoneCb)).To(Equal(reflect.ValueOf(cb)))
+ Expect(reflect.ValueOf(s.queue[1000].DoneCb)).To(Equal(reflect.ValueOf(cb)))
+ })
+
Context("Overlapping Stream Data detection", func() {
var initialCb1, initialCb2, initialCb3 func()
var initialCb1Called, initialCb2Called, initialCb3Called *bool |
Just noticed that |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: