Echo streaming ServiceCall is loosing elements

Hi,
I have an issue with lost elements when using a streaming ServiceCall. I’ve boiled it down to a simple echo endpoint. A minimal example can be found here.
The setup is:

  • A client service is calling another ServiceCall[Source[Int, NotUsed], Source[Int, NotUsed]] echo service with an input of Source(1.to(8))
  • The called service only logs the elements and returns the same same elements

One would expect the client to receive exactly the same elements ([1,2,3,4,5,6,7,8]) as it is sending. But looking at the result (and the logs) you can see the following for multiple calls:

> curl localhost:61377/api/test
[1,2]%

> curl localhost:61377/api/test
[]%

> curl localhost:61377/api/test
[1,2]%   
  
> curl localhost:61377/api/test
[1,2,3,4]%    
    
> curl localhost:61377/api/test
[1,2,3,4,5,6,7]%

It’s always loosing elements, sometimes some, sometimes all. What’s happening there?

Lagom: 1.5.5

Cheers
Andreas

EDIT: The same is happening with Lagom 1.6.0

Got it, once the websocket Source finishes the whole connection is teared down as described

https://doc.akka.io/docs/akka-http/current/client-side/websocket-support.html?language=scala#half-closed-websockets
https://www.lagomframework.com/documentation/1.5.x/scala/TestingServices.html#How-to-test-streamed-request/response