Skip to content

Commit ed9b36c

Browse files
committed
Drop unsafe from PQconsumeInput FFI import
Some paths in PQconsumeInput can go into blocking I/O calls. This has really bad interactions with GC; the RTS ends up waiting on IO (potentially, network) before being able to start Garbage Collection -- meanwhile, any Haskell mutation is blocked all this time. See the related research in: https://gitlab.haskell.org/ghc/ghc/-/issues/18415 Regardless of further issues in GHC RTS -- this call *must not* be marked "unsafe".
1 parent 5cd4081 commit ed9b36c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Database/PostgreSQL/LibPQ.hsc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2510,7 +2510,7 @@ foreign import ccall "libpq-fe.h PQcancel"
25102510
foreign import ccall unsafe "libpq-fe.h PQnotifies"
25112511
c_PQnotifies :: Ptr PGconn -> IO (Ptr Notify)
25122512

2513-
foreign import ccall unsafe "libpq-fe.h PQconsumeInput"
2513+
foreign import ccall "libpq-fe.h PQconsumeInput"
25142514
c_PQconsumeInput :: Ptr PGconn -> IO CInt
25152515

25162516
foreign import ccall unsafe "libpq-fe.h PQisBusy"

0 commit comments

Comments
 (0)