ChilliCream/graphql-platform

Missing part of the response when using batched queries

Closed this issue · 4 comments

Product

Hot Chocolate

Version

14.1.0

Link to minimal reproduction

https://github.com/alex123098/hc-race-condition

Steps to reproduce

  1. Make sure you have curl installed
  2. Clone the repository
  3. Run the project using dotnet run
  4. Run the repro.sh script, which sends two queries batched into a single HTTP request
  5. Observe the output of the script

What is expected?

I expect one of 2 valid outputs:

---
Content-Type: application/json; charset=utf-8

{"requestIndex":1,"data":{"author":{"name":"Jon Skeet"}}}
---
Content-Type: application/json; charset=utf-8

{"requestIndex":0,"data":{"book":{"title":"C# in depth."}}}
-----

or

---
Content-Type: application/json; charset=utf-8

{"requestIndex":0,"data":{"book":{"title":"C# in depth."}}}
---
Content-Type: application/json; charset=utf-8

{"requestIndex":1,"data":{"author":{"name":"Jon Skeet"}}}
-----

What is actually happening?

4 times out of 5 the server returns results of only one query from the batch

Relevant log output

Additional context

I get the expected behavior if I remove calls to Task.Delay from both resolvers.

This is the expected behavior... this is the new request batching protocol. Thats why it has a request index so that we can stream it down. This is part of the new composite schema specification effort we are doing together with Apollo, Netflix and The Guild.

Ah ... what you are saying is that one output is missing? I will have a look at it.

This is the expected behavior

was referring to the fact that it can be out of order.

@alex123098 check out the following release and reopen if its not fixed with it.
https://github.com/ChilliCream/graphql-platform/releases/tag/14.3.0-p.2