Skip to content
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

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

Open
LeeTibbert opened this issue Dec 6, 2022 · 6 comments

Comments

@LeeTibbert
Copy link
Collaborator

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).

@armanbilge
Copy link
Owner

I'm not entirely sure if I understood your question, but I think it relates to these lines:

val echoServer = server.map { socket =>
socket.reads
.through(socket.writes)
.onFinalize(socket.endOfOutput)
}.parJoinUnbounded

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.

@LeeTibbert
Copy link
Collaborator Author

LeeTibbert commented Dec 6, 2022

"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.

@armanbilge
Copy link
Owner

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
Copy link
Owner

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.

@LeeTibbert
Copy link
Collaborator Author

LeeTibbert commented Dec 6, 2022

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 ;-)

@armanbilge
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants