#5494: "PAP object entered!" error when throw is used instead of throwIO
-----------------------------------+----------------------------------------
Reporter: mikhail.vorozhtsov | Owner:
Type: bug | Status: new
Priority: normal | Component: Runtime System
Version: 7.3 | Keywords:
Testcase: | Blockedby:
Os: Linux | Blocking:
Architecture: x86_64 (amd64) | Failure: Runtime crash
-----------------------------------+----------------------------------------
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):
1. `tryConnect` calls `sslTryHandshake`
2. `sslTryHandshake` calls `_ssl_connect` which returns -1
3. `sslTryHandshake` calls `_ssl_get_error` which returns 5
(`SSL_ERROR_SYSCALL`)
4. `sslTryHandshake` calls `throwSSLException` which in this case is
{{{throw SSLIOError}}}
5. 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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5494>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs