kazu-yamamoto / quic

IETF QUIC library in Haskell
BSD 3-Clause "New" or "Revised" License
91 stars 12 forks source link

simple client example fails with client: user error #23

Closed jvanbruegge closed 2 years ago

jvanbruegge commented 2 years ago

Hi, I was trying to write a simple http3 client, but I get an error even before that, when trying to create the connection Running just:

module Main (main) where

import Network.QUIC.Client (defaultClientConfig, run)
import Network.QUIC.Internal (ccDebugLog)

main :: IO ()
main = run (defaultClientConfig { ccDebugLog = True }) (const $ pure ())

spits out the following output at runtime:

Original CID: 5437f3ac804344d0
debug: sender: user error (Pattern match failure in do expression at libraries/base/GHC/Event/Thread.hs:216:3-10)
debug: readerClient: user error (Pattern match failure in do expression at libraries/base/GHC/Event/Thread.hs:216:3-10)
debug: receiver: user error (Pattern match failure in do expression at libraries/base/GHC/Event/Thread.hs:216:3-10)
client: user error (Pattern match failure in do expression at libraries/base/GHC/Event/Thread.hs:216:3-10)

I tried with quic-0.0.0, quic-0.0.1 and the current master, all with the same result. It also does not matter if there is a server running or not

In case it is needed, this is the stack.yaml that I used:

resolver:
  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/18.yaml

packages:
  - .

extra-deps:
  - http3-0.0.0@sha256:7b61249438eb46933729c0d0a9d98aa5b60ada2fec089bff811413a38b6506dd,7179
  - quic-0.0.1@sha256:7afafe36d5d744ddf851fc7a21765ce7a5c7e6877ddb04caf180e926a7051977,8827
  - crypto-token-0.0.1@sha256:37291934c02a23d5dccf3bb2f5deb0f8208d862575af07b28beec8257d450c2a,862
  - network-3.1.2.5@sha256:433a5e076aaa8eb3e4158abae78fb409c6bd754e9af99bc2e87583d2bcd8404a,4888
  - sockaddr-0.0.0@sha256:abd855de908f0b846409335d60ffc69b279ff869f9575fb85934f4fe0d378867,787
  - warp-quic-0.0.0@sha256:b994792222f1e1ff5edf320076bf0a7bf838d98956a18569eee993434fa8a826,914

nix:
  packages: [zlib]

I have no idea what the problem is here

kazu-yamamoto commented 2 years ago

I guess that you don't specify -threaded to GHC. In Haskell network programming, this flag is a MUST.

jvanbruegge commented 2 years ago

Thank you, that was indeed the issue. I forgot to add -threaded to my ghc options.