-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Occasional empty / zero byte streams at high load #318
Comments
Thanks for the detailed issue. Normally in a situation like this I would cast suspicion on all the Apollo and fastify stuff influencing the streams, but it sounds like your investigation has moved passed that. It would be interesting to see if you have the same problem after upgrading to You can see an explanation about when our |
One thing you could do as an experiment is copy-paste the new |
I will try to conduct the experiment on a much simpler project with fewer dependencies. |
I was able to conduct the experiment both with Both were experiencing the same zero-length buffer issue but is more frequent on the newer version, I've attached some screenshots. v13.0.0v15.0.0 with patched fs-capacitorHere's the repository of the experiment |
I don't have much to add except to say, great job @captainjapeng! Thanks for your diligent work figuring this out. We have a conundrum because if the fix (i.e. mike-marcacci/fs-capacitor#76) is applied to |
I understand, our solution with
|
Hi folks – @captainjapeng thanks for the diligent research on this. @jaydenseric I'm happy to entertain dual publishing |
It seems the idea to dynamic import pure ESM Side note about the dynamic import approach; I had an idea about doing the dynamic import on the first function call, and storing the result in a Thanks for offering to add a CJS entry point to |
Hi!
First of all, thank you for this great library! I've been using it for a couple of years now and it really makes the GraphQL developer experience better 🙂.
Unfortunately, we're seeing occasional errors where the
createReadStream()
would have zero bytes on our production environment with very little load running on GKE even though the whole multipart request was received (I've added a PassThrough stream to print out the whole request when the stream length is zero).I have been able to replicate this on a local K8S when load testing the service at 40-60 rps with a chance of around 1 in 5000. Basically, the service in question here is a GraphQL Gateway, we're using
graphql-upload v13.0.0
's processRequest as a middleware forfastify
to process the body and then passing it toapollo-server-fastify
and@apollo/gateway
together with apollo-federation-file-upload as the datasource to replay the file upload.My initial assumption was that it has something to do with the networking/parsing layer but I had run a separate test using the received request body directly to
dicer
in a >100,000 loop to see if it was the cause but the result didn't have any errors parsing the multipart.I have a couple of theories as to why this happens.
fs-capacitor
I have learned that all file uploads create a temporary file so maybe during high load it fails to create a temporary possibly due to too many files being open? I'm currently thinking if this is related to this issueonData
andonEnd
was never called, I'm not super experienced when it comes to streams but would it be possible forcreateReadStream()
to execute before the data is written to the FileStream?createReadStream
.Our solution right now is to migrate to graphql-upload-minimal since we're only using the stream to pass through to the receiving backend service. I haven't encountered the issue so far with this setup even at 120 rps load.
The text was updated successfully, but these errors were encountered: