"PAP object entered!" error when throw is used instead of throwIO
The following program
import qualified OpenSSL.Session as SSL
import OpenSSL (withOpenSSL)
import System.Posix.Types (Fd(..))
main = withOpenSSL $ do
ctx <- SSL.context
ssl <- SSL.fdConnection ctx (Fd (-1))
SSL.tryConnect ssl
return ()
triggers a "PAP object entered!" crash in HsOpenSSL 0.10.1:
$ ghc-7.3.20110916 -fforce-recomp Bug.hs
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Linking Bug ...
$ ./Bug
Bug: internal error: PAP object entered!
(GHC version 7.3.20110916 for x86_64_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
zsh: abort ./Bug
The order of things is as follows (OpenSSL.Session module):
-
tryConnectcallssslTryHandshake -
sslTryHandshakecalls_ssl_connectwhich returns -1 -
sslTryHandshakecalls_ssl_get_errorwhich returns 5 (SSL_ERROR_SYSCALL) -
sslTryHandshakecallsthrowSSLExceptionwhich in this case isthrow SSLIOError - Program crashes
If I either replace throw with throwIO or build HsOpenSSL with -O0, the crash goes away. I haven't checked 7.2.1, but 7.0.3 doesn't have this issue.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Runtime System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |