-
Notifications
You must be signed in to change notification settings - Fork 56
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
Simple query hangs forever #79
Comments
Thanks for trying out the beta! The early bird use-testing will be very helpful! I have no doubt it is a Hasql bug, so it shouldn't have anything to do with the GHC version or Postgres. Hasql's beta version is under active development and is very poorly tested so far, so bugs like this should come at no surprise. I'm currently focused on other tasks with the beta, but I will address this bug soon, and it will be included in the test-suite. Thanks for reporting! |
Thanks for the quick response! Let me know if I can do anything to help. |
That would very much depend on the level of involvement you're looking for. The largest issue right now is optimizing the GC. I'm currently at the level of 65% of efficiency and considering the possible causes and reapproaching some of the problems all over. In case that's too much I'll definitely need testers, once I solve that, so I'll keep you in mind. |
I know next to nothing about garbage collectors, much less optimizing GHC's. I'm not at all familiar with Hasql's internals, so I'll poke around there and see if I can make any productive changes 😄 |
Unrelated to the original issue, I had some trouble building this project on my machine.
I worked around it by passing |
For what it's worth, I have chased the original problem down to this line: hasql/library/Hasql/Core/Dispatcher.hs Line 57 in 65fa1ff
Abusing STM a little, I can see that both diff --git a/library/Hasql/Core/Dispatcher.hs b/library/Hasql/Core/Dispatcher.hs
index 1268dc8..32e2821 100644
--- a/library/Hasql/Core/Dispatcher.hs
+++ b/library/Hasql/Core/Dispatcher.hs
@@ -54,6 +55,11 @@ performRequest (Dispatcher _ _ _ _ _ serializerMessageQueue _ resultProcessorQue
writeTQueue resultProcessorQueue (K.ResultProcessor ir (atomically . putTMVar resultVar))
writeTQueue serializerMessageQueue (H.SerializeMessage builder)
writeTQueue serializerMessageQueue (H.FlushMessage)
+ atomically $ do
+ x <- tryReadTMVar transportErrorVar
+ Debug.Trace.traceM ("transportErrorVar = " ++ show x)
+ y <- tryReadTMVar transportErrorVar
+ Debug.Trace.traceM ("resultVar = " ++ show y)
atomically (fmap (Left . TransportError) (readTMVar transportErrorVar) <|> takeTMVar resultVar)
stop :: Dispatcher -> IO ()
That's not really a problem, though. It should |
Concerning the tick factor thing, it's a GHC bug. You can report it on it's tracker. In the mean time we'll have to work around it in Hasql to stay compatible with GHC 8.0. Concerning the freeze issue, thanks for looking at it! Yes, it seems most likely that the result processor never puts the result in the var. I'll take a look. |
Great, thanks! Seems like the GHC bug has already been reported: https://ghc.haskell.org/trac/ghc/ticket/14338 |
I want to handle Postgres notifications with Hasql. I read through #43 and ended up trying out version 0.20.0.1. Unfortunately I didn't get to notifications because I couldn't get a simple query to work. It hangs forever when trying to execute the query. I'm doing something like this:
I put the whole thing in a Gist. I definitely could be doing something wrong. Is this correct? If so, why is it hanging forever?
This happens on my macOS laptop with GHC 8.2.1 and Postgres 10. I also tried Postgres 9.6 and an unprepared statement; both of those hung forever too.
The text was updated successfully, but these errors were encountered: