fs2-io_uring icon indicating copy to clipboard operation
fs2-io_uring copied to clipboard

Suspected logic error in: test("echo requests - each concurrent client gets back what it sent")

Open LeeTibbert opened this issue 3 years ago • 6 comments

I suspect a logic error in: test("echo requests - each concurrent client gets back what it sent") .

I am a FS2 beginner, so pardon me if I do not understand something subtle.

If I read correctly, all of the clients are sending the same message "fs2.rocks". If there is any cross-wiring how is it detected? That is, if the server reads client-2 twice instead of client-2 then client-3, how is this detected? Client-3 gets back what client-2 sent but the results are indistinguishable.

A fix makes the test harder to implement, but I believe it would live up to its intent if each client added something like an Int (fs.rocks-2).

LeeTibbert avatar Dec 06 '22 01:12 LeeTibbert

I'm not entirely sure if I understood your question, but I think it relates to these lines: https://github.com/armanbilge/fs2-io_uring/blob/15f672763ed3b2279cdadadb045c6eb64a5b7a8a/uring/src/test/scala/fs2/io/uring/net/TcpSocketSuite.scala#L69-L73

What is happening here is that

  1. a socket is "emitted" (server.map { ) from the server for every connected client.
  2. data read from this socket is written back to that same socket (socket.reads .through(socket.writes)
  3. each of these connections is run in parallel (.parJoinUnbounded)

So there should not be any cross-wiring between connections.

armanbilge avatar Dec 06 '22 01:12 armanbilge

"So there should not be any cross-wiring between connections."

Thank you for the explanation, it will help in my tracing the "errno 107".

I concur that there should not be any cross-wiring, especially at the level you describe. However, if the implementation below is doing something untoward, how can a test which sends the same data for each client detect any cross-talk? Each connection must have distinguishable data in order to do that.

Again, this is a test, where it has to assume that the world it is testing is prone to fail.

LeeTibbert avatar Dec 06 '22 01:12 LeeTibbert

how can a test which sends the same data for each client detect any cross-talk? Each connection must have distinguishable data in order to do that.

That's a good point. We change the test so it sends unique data for each client. Would you like to give that a try? :)

armanbilge avatar Dec 06 '22 01:12 armanbilge

Oh, now I see what you are getting at 😆

"echo requests - each concurrent client gets back what it sent"

You are absolutely right, the test is not really checking this :) I copied this test out of FS2 proper, we should probably fix it there as well.

armanbilge avatar Dec 06 '22 01:12 armanbilge

Would you like to give that a try? :)

Thank you for the vote of confidence. Can we queue that attempt until after we have dispatched the "errno 107"? I think the Issue is worth capturing but I think the "errno 107" is telling us something.

Your call.

re: copied from FS2

The old "I did not get it wrong, I copied it from Johnny's paper and they got it wrong" defense ;-)

LeeTibbert avatar Dec 06 '22 01:12 LeeTibbert

Oh sure, I thought this would help with the errno 107. If not then we can backlog this :)

armanbilge avatar Dec 06 '22 01:12 armanbilge