-
Notifications
You must be signed in to change notification settings - Fork 6
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
Prevent SIGPIPE
signals
#35
Comments
Ha, can't say I wasn't warned! This is the bug that @lolgab stumbled on 😆 |
@LeeTibbert would you happen to know how to write a test for this? I've tried the obvious (wrong?) thing of writing to a socket whose peer is closed but that doesn't seem to trigger it. test("writing to closed socket".only) {
IOServerSocketChannel.open.use { server =>
IOSocketChannel.open.use { clientCh =>
for {
_ <- server.bind(new InetSocketAddress("localhost", 0))
gate <- IO.deferred[Unit]
_ <- (server.accept.use_ *> gate.complete(())).background.surround {
for {
addr <- server.localAddress
_ <- clientCh.connect(addr)
_ <- gate.get
_ <- clientCh.write(ByteBuffer.wrap("Hello!".getBytes))
_ <- IO.println("here")
} yield ()
}
} yield ()
}
}
} |
Ahahaha this was enjoyable reading. https://blog.erratasec.com/2018/10/tcpip-sockets-and-sigpipe.html
|
re:
Interesting & informative article at the URL you posted. Good to have that for future reference. I suspect the key is the paragraph below:
For future reference: At a first approximation, I believe that it is not worth investing the time at this stage of the project creating Preaching to the choir.To my thinking, code testing overall is a Bayesian "building confidence " exercise:
|
Yes, I suspect this too. But I decided not to go on a wild goose chase 😁 Maybe in the future we can have some form of integration tests that can help exercise these sorts of issues. |
Some advice from https://rigtorp.se/sockets/#prevent-sigpipe-signals. H/t Lee.
The text was updated successfully, but these errors were encountered: