FAQ
Hi Darren,

that's great -- thanks for the effort to bring DBD::SQLite back up to
date! I'm not sure where to send my bug reports, so I'll try the new
DBD::SQLite mailing list.

I'm getting the same "make test" failures as I had previously with
DBD::SQLite::Amalgamation (while the old DBD::SQLite worked ok), but
now they happen both on Mac OS X and Debian Linux 64-bit (previously,
Debian was ok). The symptoms are the same in both cases:

t/08create_function..... Failed 13/18 subtests

and

$ perl -Mblib t/08create_function.t
1..18
ok 1 - The object isa DBI::db
ok 2 - Got a result
ok 3
ok 4
ok 5
Segmentation fault

The segfault is triggered when the Perl callback function dies. If I
comment out the "die" in error():

sub error {
# die "function is dying: ", @_, "\n";
}

The test script runs through and only reports two errors because the
error() callback doesn't work as expected.

For completness' sake, here are the platform details:

1) Mac OS X 10.5.5 on Intel Core 2 Duo, Apple-supplied Perl 5.8.8

2) Debian 5.0 (Lenny) 64-bit on AMD Opteron, standard Debian Perl 5.10.0


As I said previously, I'd be happy to try and help; I am reasonable
familiar with C and have written some XS code, though I don't know the
DBI interface at all.


Thanks again & best wishes,
Stefan



--
The wonders of Googleology (episode 1)

"from collectibles to cars"
84,700,000 -- Google
9,443,672 -- Google N-grams (Web 1T5)
1 -- ukWaC

[ stefan.evert@uos.de | http://purl.org/stefan.evert ]

Search Discussions

  • Michael Lackhoff at Mar 29, 2009 at 7:01 pm

    On 29.03.2009 18:44 Stefan Evert wrote:

    I'm getting the same "make test" failures as I had previously with
    DBD::SQLite::Amalgamation (while the old DBD::SQLite worked ok), but
    now they happen both on Mac OS X and Debian Linux 64-bit (previously,
    Debian was ok). The symptoms are the same in both cases:

    t/08create_function..... Failed 13/18 subtests

    and

    $ perl -Mblib t/08create_function.t
    1..18
    ok 1 - The object isa DBI::db
    ok 2 - Got a result
    ok 3
    ok 4
    ok 5
    Segmentation fault
    Same here on Ubuntu 8.04 32bit. As I reported before, no problems on
    Windows XP.

    -Michael
  • Darren Duncan at Mar 30, 2009 at 12:25 am
    Stefan, thanks for your report, and Michael for your confirmation.

    If you think you might be able to root out the problem and fix it, then please
    do; patches are welcome. You may also want to file an RT item on this. Or
    maybe check and see if any existing RT items refer to the same problem and if so
    then you could annotate the problem still exists in 1.19_02.

    Thank you. -- Darren Duncan

    Stefan Evert wrote:
    I'm not sure where to send my bug reports, so I'll try the new
    DBD::SQLite mailing list.

    I'm getting the same "make test" failures as I had previously with
    DBD::SQLite::Amalgamation (while the old DBD::SQLite worked ok), but now
    they happen both on Mac OS X and Debian Linux 64-bit (previously, Debian
    was ok). The symptoms are the same in both cases:

    t/08create_function..... Failed 13/18 subtests

    and

    $ perl -Mblib t/08create_function.t
    1..18
    ok 1 - The object isa DBI::db
    ok 2 - Got a result
    ok 3
    ok 4
    ok 5
    Segmentation fault

    The segfault is triggered when the Perl callback function dies. If I
    comment out the "die" in error():

    sub error {
    # die "function is dying: ", @_, "\n";
    }

    The test script runs through and only reports two errors because the
    error() callback doesn't work as expected.

    For completness' sake, here are the platform details:

    1) Mac OS X 10.5.5 on Intel Core 2 Duo, Apple-supplied Perl 5.8.8

    2) Debian 5.0 (Lenny) 64-bit on AMD Opteron, standard Debian Perl 5.10.0

    As I said previously, I'd be happy to try and help; I am reasonable
    familiar with C and have written some XS code, though I don't know the
    DBI interface at all.
  • Stefan Evert at Mar 31, 2009 at 12:03 am

    On 30 Mar 2009, at 01:25, Darren Duncan wrote:

    Stefan, thanks for your report, and Michael for your confirmation.

    If you think you might be able to root out the problem and fix it,
    then please do; patches are welcome. You may also want to file an
    RT item on this. Or maybe check and see if any existing RT items
    refer to the same problem and if so then you could annotate the
    problem still exists in 1.19_02.
    I'm about to go on a trip and will be away for a next week, so I don't
    have time to set up a RT item (I need to get an account there first,
    and all that ...).

    However, I played around a little with the source code and came a
    little closer to tracking down the source of the segfaults. Perhaps
    the SQLite gurus can help us out from here?

    Apparently, the segfault is triggered when Perl calls

    sqlite3_result_error( context, s, len );

    to signal an exception in the Perl callback function. As soon as the
    string s[] is longer than 22 characters (excluding the NUL
    terminator), I get a segfault (in Mac OS X 10.5.6 Intel; can't check
    Linux at the moment as our server is down). This doesn't seem to have
    anything to do with Perl, because I get exactly the same behaviour
    when I change the function call (dbimb.c, line 780) to a constant
    string:

    sqlite3_result_error( context, "........1.........2....", 23 );

    If I change 23 to 22, the program runs through.

    Sounds a bit like a buffer overflow in the SQLite code to me, but I
    know far too little about SQLite internals to chase this down easily.

    Best,
    Stefan
  • Michael Lackhoff at Mar 31, 2009 at 7:23 am

    On 31.03.2009 01:03 Stefan Evert wrote:

    However, I played around a little with the source code and came a
    little closer to tracking down the source of the segfaults. Perhaps
    the SQLite gurus can help us out from here?
    I saw that you are on the SQLite list as well and you seem to know what
    you are talking about when it comes to C code debugging. Could you
    explain your findings there -- perhaps after your trip?
    If I can be of any help I am willing to do what is within my capability
    but I don't know any C at all.

    -Michael
  • Stefan Evert at Apr 9, 2009 at 5:01 pm

    However, I played around a little with the source code and came a
    little closer to tracking down the source of the segfaults. Perhaps
    the SQLite gurus can help us out from here?
    I saw that you are on the SQLite list as well and you seem to know
    what
    you are talking about when it comes to C code debugging. Could you
    explain your findings there -- perhaps after your trip?
    If I can be of any help I am willing to do what is within my
    capability
    but I don't know any C at all.
    Oops, I'm afraid my report was a bit premature. After rebooting my
    system (I didn't expect _that_ to be a factor, either :-), the
    behaviour changed from crashing for error messages exceeding 22
    characters to crashing for any error message at all. Plus, I could
    sometimes avoid the crashes by running the test script from a debugger
    (gdb).

    There's a good quote from Richard Hipp about this kind of behaviour:

    <quote>
    Of course, I wasted 4 hours tracking the problem down..... This is
    yet another episode that demonstrates how threads are a pernicious
    evil that should be studiously avoided in any program that you
    actually want to work. Threads cause hard-to-trace bugs. Threads
    result in non-deterministic behavior. Threads make programs run
    slower. Just say "No" to threads ...
    </quote>

    It turned out that the crashes are triggered by a Perl interpreter
    with threading support, which in turn causes DBD::SQLite to compile
    the SQLite source code in threadsafe mode. Manually adding "-
    DTHREADSAFE=0" to the compile options fixed the problem, and the
    entire test suite was passed successfully.

    The good news is that the newly released version 1.22_02 of
    DBD::SQLite works out of the box on both platforms I have access to
    (Mac OS X 10.5.6 / Intel and Debian Linux 64-bit). Possibly related
    to some bug fixes in SQLite 3.6.12?

    Anyway, thanks for your great work on DBD::SQLite, Darren! Looks like
    we've got a fully functional and up-to-date version now, at least on
    my platforms.

    Best wishes,
    Stefan

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbd-sqlite @
postedMar 29, '09 at 5:44p
activeApr 9, '09 at 5:01p
posts6
users4
websiteshadowcat.co.uk

People

Translate

site design / logo © 2021 Grokbase