Skip to content
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

GOAWAY frame can overtake final DATA frame #87

Closed
edsko opened this issue Aug 31, 2023 · 3 comments · Fixed by #89
Closed

GOAWAY frame can overtake final DATA frame #87

edsko opened this issue Aug 31, 2023 · 3 comments · Fixed by #89

Comments

@edsko
Copy link
Collaborator

edsko commented Aug 31, 2023

(This is the corrected issue from #86 ).

I was getting non-deterministic test failures in my test suite. I think it's because when the client sends the final message to the server and then disconnects, there is a race condition between the final DATA frame and the GOAWAY frame. Successful test run:

image

(The client is sending the value "4" before disconnecting).

Failing test run:

image
image

This is the exact same test, but the frame ordering has been reversed: since the server sees the GOAWAY frame first, it never receives the client's final message.

Possibly related: #78.

I am currently using a (rather nasty) workaround by having a threadDelay 1_000 before closing the connection and after sending the final message.

@kazu-yamamoto
Copy link
Owner

We should ensure that all threads for streaming (spawned with forkManaged) are finished after x <- client $ ... and before let frame = goawayFrame.
An easy way to implement this is provide an STM counter and check (cnt == 0).

@kazu-yamamoto
Copy link
Owner

Goaway data should hold MVar and the client should takeMVar after putting it into the queue.
Sender should putMVar after sending.
I will take care of this next week.
Have a good weekend.

@edsko
Copy link
Collaborator Author

edsko commented Sep 1, 2023

Fantastic, thanks @kazu-yamamoto :) I can check after ICFP if your patch fixes my test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants