mdedetrich / pekko-streams-circe

Pekko Streams support for JSON via Circe
Apache License 2.0
7 stars 2 forks source link

Fix JsonStreamParser.head[J] #36

Open mdedetrich opened 10 months ago

mdedetrich commented 10 months ago

Resolves: https://github.com/mdedetrich/pekko-streams-circe/issues/15

@gchudnov I am trying to create a failing test for this usecase, specifically a lazy streamed chunked http response (in response to what you wrote in the issue) and I am not having much luck. Would it be possible to help out here, i.e. do you have some idea of the JSON content that was causing the problem or maybe it was another issue (i.e. the chunks were coming in extremely slowly???)

mdedetrich commented 10 months ago

Okay so I think I may have gotten somewhere, i.e. if I add a .delay(10.seconds) to the Source that provides the chunked data then I get empty head of list, I guess there is some timeout going on here.

Lets see if I can reproduce this in akka-streams JSON to see if behaviour is the same or different.

mdedetrich commented 10 months ago

So annoying news, I put the exact same test into akka-streams-json (which is set to Akka 2.6.20 where you report that it worked) and its behaving the same way as Pekko.

@gchudnov I have a sneaking suspicion that there wasn't any behaviour change (I guess if there was it would have already been reported one way or another) but rather there were at some points in time really slow chunked responses? I can reproduce head of empty stream but not the source never completing/finishing even though I am doing Source.fromIterator(() => s.grouped(1) which means every single character is in its own chunk.

In any case the test is setup so you can play around with it to see if you can somehow reproduce the scenario (and more critically confirm if behaviour in akka-streams-json is different)

gchudnov commented 10 months ago

@mdedetrich Thank you for trying to reproduce it, I'll check soon

gchudnov commented 10 months ago

hm.. indeed something tricky, trying to restore the code that was producing an error and reproduce.