[Haskell-cafe] Oracle Sessions in Takusen

Alistair Bayley alistair at abayley.org
Thu Jun 2 21:56:07 CEST 2011


On 3 June 2011 05:35, Kevin Quick <quick at sparq.org> wrote:
> Dmitry,
>
> I'm not directly familiar with Takusen or its use with OracleDB, but I would
> hazard a guess that the withSession is doing FFI resource management and
> that resources obtained inside the withSession environment are no longer
> valid outside of the withSession.
>
> If this is the case then I would expect the following to work:
>
>   replicateM 2 (do
>        withSession (connect "x" "x" "x") (do
>              res <- doQuery ...
>              liftIO $ print res
>            )
>        )
>
> If this really is the case then it seems that withSession shouldn't be
> exporting FFI-based resources.
>
> -KQ

You're right, withSession shouldn't be exporting FFI obtained
resources, and I don't think it does. There are some known issues with
the Oracle code, where it allows buffers to fall out of reference (and
thus be gc'd) before the C libs have finished with them, thereby
causing segfaults. The known problems are around bind variable
buffers, so this looks like a new issue.

At least we're collecting a nice corpus of programs that cause the
Oracle backend to fail :-) I'd love to have more time to work on it...

If you don't need the Oracle-specific functionality, for now I suggest
using the ODBC driver as a substitute, as this seems to be (more)
reliable.

Alistair



More information about the Haskell-Cafe mailing list