Repository navigation
New exception behavior in recv causes existing code to break #215
Description
Activity
Agreed on your analysis @snoyberg. We'll need to get a minimal test case in to guard against this type of behavior change in the future.
Looks to be introduced in #200. I'll dig a bit deeper later and see about producing a fix and minimal test case.
Awesome, thank you for looking into this so quickly! I think the example I gave above should be distillable into a minimal test case. Let me know if you'd like me to do anything to assist on this.
Well, the culprit is here:
https://github.com/haskell/network/blob/master/Network/Socket.hsc#L739The
recvfamily of functions inSocketdiffer from theSocket.ByteStringfamily in throwing an EOF. This difference is certainly annoying, but easy enough to fix.The path for now will be reintroducing duplication.
Well the fix is available with a minimally altered version of your case. I haven't had a chance to attempt to boil it down to anything simpler, but the current formulation can suffice.
@snoyberg If you have some time to reduce it this weekend let me know. I'll be preoccupied with moving, so I won't have time. Otherwise I'd say this can drop with a point release.
@kazu-yamamoto Any thoughts?
Here is minimal reproducer for you (extracted from simple-sendfile-0.2.25):
module Main (main) where import qualified Network.Socket as NS import qualified Network.Socket.ByteString as NSB main :: IO () main = do (s1,s2) <- NS.socketPair NS.AF_UNIX NS.Stream 0 NS.close s1 NSB.recv s2 1 >>= print NS.close s2
network-2.6.3.0:
$ runhaskell bug.hs bug.hs: Network.Socket.recvBuf: end of file (end of file)network-2.6.2.1:
$ runhaskell bug.hs ""- added a commit that references this issue
on Jul 30, 2016 @trofi Perfect!
A point release has been uploaded to hackage. Thank you both for your help.
Thank you!
On Sun, Jul 31, 2016, 6:52 AM Evan Borden [email protected] wrote:
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#215 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AADBB_KB3q3A-JhCPkvTf7tI_4S4f9JZks5qbBv0gaJpZM4JXA2h
.
Consider the following code snippet:
When I run it on my machine, I get the output:
By contrast, if I change the network package version to 2.6.2.1, the program does not exit with an exception. The previous behavior - and behavior that many programs rely on - is that in the case of a closed connection an empty bytestring is returned. I would consider the older behavior preferable, and the change a bug.
Original issue was opened against stackage for a number of failures: commercialhaskell/stackage#1739