-
Notifications
You must be signed in to change notification settings - Fork 10
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
Data corruption using WriteFixed #4
Comments
I can work on a repro for this if desired |
I'll try taking a look at this tonight, I know there are probably some memory model violations that need to be investigated more and I'm almost certain that synchronization is not correct. At first glance using |
You can add some example code and put it in the |
So the one thing I see with the example code is that it isn't advancing the head of the completion queue, see the |
I've made a few commits to my https://github.com/ImVexed/iouring-go/tree/buffers branch testing if I also seemed to have found a weird interaction between flushing the headers and immediately hijacking. Adding a delay in-between the two seems to fix it. |
I wonder if there is a race in |
I took out the if _, err := nc.Write([]byte("HTTP/1.1 200 OK\r\nConnection: keep-alive\r\nContent-Type: text/event-stream\r\nTransfer-Encoding: chunked\r\n\r\n")); err != nil {
log.Fatalln(err.Error())
} And even mutex lock the entire handler but still get EOF's Narrowing it down some more I seem to get the EOF's even on a Handler that only Hijacks and nothing more. |
Huh, fixed. Chaning Though that may be an issue underlyingly in the SSE client. |
What specifically needs to be done to the sq/cq after enter is finished to support wrapping? I've been playing with the Heads/Tails of both and can't seem to get it to properly wrap even with |
I've mad a few changes to I've been working in |
Hmm, I can't validate against any of the tests since most tests on master are failing with
After it reaches 1k it will lock indefinitely. Should I be checking if the remaining space from Cq |
I've fixed some of the tests on master and the
Yeah, do a check and if the number of SQEs that are being added is too large then write until the end of the Sq and wrap the rest from the start. I might have fixed a bug in |
That seemed to fix it! However now it's locking up around 2x the limit:
|
I would start by using |
Hmm, could that potentially cause a scenario where |
From what I've read in the docs the kernel will copy it over async. This might be useful as well, but I'm not sure if you care about CQEs getting overwritten? I'm still working on the design on |
Using this code:
I'm consistently getting data overwritten as it's sent to the client. I had a test that opens 1000 connections which all get the same
WriteFixed
submit entry, however upon looking at what they receive:You'll see that we receive the message properly for some clients, but will occasionally receive a message like the last, where the end of the message is seemingly overwritten by the message.
I've ensured that there are no duplicate file descriptors causing 2 writes to be queued in the same ring for the same fd.
The text was updated successfully, but these errors were encountered: