kazu-yamamoto / quic

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

Document that `-threaded` is required (better yet, check for it) #48

Closed edsko closed 1 year ago

edsko commented 1 year ago

First of all, thanks for creating this package and making it available!

I struggled a lot getting anything to work, until I eventually enabled scDebugLog, and then found in the logs

Original CID: e7cd837d666450d9ddd34922c9c65d0e979389a8
Packet size: 1350 (1200)
debug: readerServer: 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)
runServer: user error (Pattern match failure in do expression at libraries/base/GHC/Event/Thread.hs:216:3-10)

That pattern match failure is this one:

getSystemTimerManager :: IO TM.TimerManager
getSystemTimerManager = do
  Just mgr <- readIORef timerManager
  return mgr

The timer manager is only available when using the threaded RTS, and compiling my code with -threaded made the problem go away.

Admittedly one could reasonably ask why I wasn't compiling my server with -threaded in the first place, but this was nonetheless a bit of a debugging journey.

kazu-yamamoto commented 1 year ago

I'm on a new-year vacation. I will probably come back to this work after a week or so. Sorry for your inconvenience.

edsko commented 1 year ago

No worries at all, enjoy your holidays! :)

kazu-yamamoto commented 1 year ago

Updated the doc (a62e7ef62e4c97b5e00bd0327f94abf2f51713db).

I think that you should also ask GHC developers to warn like "the -threaded option is required" in the Nothing case.

edsko commented 1 year ago

Hey, what are you doing here, go enjoy your holidays! :) As regards ghc, I agree, but I just checked 9.4.4 and there at least it's there:

getSystemTimerManager :: IO TM.TimerManager
getSystemTimerManager =
  fromMaybe err `fmap` readIORef timerManager
    where
      err = error "GHC.Event.Thread.getSystemTimerManager: the TimerManager requires linking against the threaded runtime"