tst2005googlecode2 / lxmppd

Automatically exported from code.google.com/p/lxmppd
0 stars 0 forks source link

luadbi segfaults trying to clean up (pgsql) statements #370

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
waquas on the prosody muc encouraged me to file this, claiming that luadbi is 
more or less maintained here now?

What steps will reproduce the problem?
1. Create a local connection (for me: pgsql)
2. Create a local statement using that connection and execute it/read the result
3. Close the connection (con:close()) but forget to do the same for the 
statement first.

What is the expected output? What do you see instead?

I expect the GC to handle that. I might expect a leak. Instead, the process 
crashes with a segfault. The stacktrace (no debugging symbols, sorry. But quite 
helpful already) is

    (gdb) bt
    #0  0x00007f7f3ce0eb2c in resetPQExpBuffer () from /usr/lib/libpq.so.5
    #1  0x00007f7f3ce02dbd in ?? () from /usr/lib/libpq.so.5
    #2  0x00007f7f3ce046b1 in PQsendQuery () from /usr/lib/libpq.so.5
    #3  0x00007f7f3ce05bf0 in PQexec () from /usr/lib/libpq.so.5
    #4  0x00007f7f3d0235c6 in deallocate (statement=0x1284278) at dbd/postgresql/statement.c:42
    #5  statement_close (L=<optimized out>) at dbd/postgresql/statement.c:83
    #6  0x00007f7f3d023609 in statement_gc (L=<optimized out>) at dbd/postgresql/statement.c:355

What version of the product are you using? On what operating system?

prosody 0.9.1, luadbi 0.5, psql 9.3
Arch Linux, 64bit

Please provide any additional information below.

Attached is my current module that triggered the bug. The workaround (or 'right 
way'™ if you will) is to close the statement explicitly. Remove that line and 
prosody will segfault. Note that this isn't 100% deterministic, the GC needs to 
be triggered (and I know too little about lua to say when it does. Most of the 
time the module caused the segfault. Sometimes - not).

Original issue reported on code.google.com by benjamin.podszun@gmail.com on 30 Oct 2013 at 6:12

Attachments:

GoogleCodeExporter commented 9 years ago
Hi, thanks for the comprehensive report! Sorry that it slipped through the 
cracks, and we're only just processing it now.

I think this might be related to a crash that I've seen reported a couple of 
times, but have never been able to reproduce. You provide some extra details 
though that could be helpful (I'd also not been able to get hold of a stack 
trace), so I'll give it another shot.

Thanks!

Original comment by MWild1 on 22 Feb 2015 at 10:26