-
Notifications
You must be signed in to change notification settings - Fork 189
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
New exception behavior in recv causes existing code to break #215
Comments
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: The 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:
network-2.6.2.1:
|
network-2.6.3.0 throws exceptions in ByteString API for 'recv'. That causes a lot of applications and libraries to break. Some examples: dev-haskell/simple-sendfile-0.2.25 dev-haskell/fluent-logger-0.2.3.1 dev-haskell/http-client-0.4.30 dev-haskell/dbus-0.10.12 Bug: haskell/network#215 Package-Manager: portage-2.3.0 RepoMan-Options: --force
@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:
|
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
The text was updated successfully, but these errors were encountered: