haskell-grpc-native / http2-client

A native HTTP2 client in Haskell
BSD 3-Clause "New" or "Revised" License
43 stars 27 forks source link

Sending _gtfo/_goaway doesn't seem to have the desired effect #32

Closed hce closed 7 years ago

hce commented 7 years ago

I'm using a long lived connection to Apple's Push Notification Service. After a timeout, I close the connection by calling _gtfo on the http2 connection. However, after a much longer period I see this in the console: UNHANDLED frame: (FrameHeader {payloadLength = 29, flags = 0, streamId = 0},GoAwayFrame 3 NoError "{\"reason\":\"Shutdown\"}")

( In case it helps, the code that I'm using the library from can be found here: https://github.com/memrange/push-notify-apn/blob/master/src/Network/PushNotify/APN.hs#L383 )

lucasdicioccio commented 7 years ago

Hi, thanks for the bug report.

There are two broad problems:

(a)

(b)

lucasdicioccio commented 7 years ago

Can you have a look at #33 for (a) and tell me whether you like it?

Same for #34 for (b). I'm parted with asking another handler at Http2Client creation, using throwTo to throw in the parent thread (likely the main one for the connection), or keeping as it is.

hce commented 7 years ago

33 looks good.

As for (b), IMHO asking for another handler is the better choice. Because when multiple connections are created from the same thread, how do you tell which connection has terminated?

lucasdicioccio commented 7 years ago

Thanks. For (b) it's a good point that there's no direct mapping between threads and connections. That said, in #35 I'm eyeing towards asking the thread control to be able to use withAsync throughout and avoid most async-exceptions bugs this way. Hence, a user who wants to run multiple concurrent connections would have to start multiple threads/asyncs. I agree that #34 on itself is insufficiently safe though. If you are happy with #33 for this bug, please close this bug (and I'll cut a release). We can discuss error-handling in #6 .

lucasdicioccio commented 7 years ago

Thanks. Released 0.3.0.3 on Hackage.

Expect 0.4.0.0 or 0.3.0.4 soon-ish for the exception handling thinggy :-).