[racket-dev] SIGSEGV MAPERR si_code 1 fault on addr (nil) when inserting rows via "db" / SQLite

From: Ryan Culpepper (ryan at cs.utah.edu)
Date: Fri Dec 16 21:41:49 EST 2011

This crash showed up again recently (thanks DrDr!), and this time I 
believe I've fixed the real problem: a bytes object that pointed into 
storage owned by another bytes object. The fix was to allocate the 
storage as 'atomic-interior instead of 'atomic.

Ryan


On 11/13/2011 02:28 PM, Ryan Culpepper wrote:
> Thanks for the report. Your program led me to find *a* bug (a space leak
> in the statement finalizer thread). Fixing that bug causes your program
> to succeed consistently, but the bug I found should not have caused the
> segfault, and I haven't been able to find an underlying problem. I'll
> push the intermediate fix; if you still run into problems let me know.
>
> Ryan
>
>
> On 11/12/2011 05:42 PM, Eric Hanchrow wrote:
>> This is with racket 5.2, from Ubuntu:
>>
>> Package: racket
>> Version: 5.2.0-3
>>
>> When I invoke the following file (on Ubuntu Linux erich-laptop
>> 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:50:42 UTC 2011 i686 i686
>> i386 GNU/Linux), I see
>>
>> $ rm -rfv /tmp/bug* ; racket ./repro.rkt
>> removed `/tmp/buggissimo'
>> SIGSEGV MAPERR si_code 1 fault on addr (nil)
>> /bin/bash: line 1: 12150 Aborted racket ./repro.rkt
>>
>> #lang racket
>>
>> (require
>> (only-in db
>> query-exec
>> query-value
>> sqlite3-connect))
>>
>> (define db
>> (sqlite3-connect #:database "/tmp/buggissimo" #:mode 'create))
>>
>> (query-exec
>> db
>> "CREATE TABLE IF NOT EXISTS
>> log_word_map(word TEXT, log_id INTEGER,
>> PRIMARY KEY (word, log_id)
>> ON CONFLICT FAIL)")
>>
>> (query-exec db "BEGIN TRANSACTION")
>>
>> (for ([x (in-range 20000)])
>> (query-exec
>> db
>> "insert into log_word_map values (?, ?)"
>> (number->string x) 99))
>>
>> (query-exec db "COMMIT")
>> _________________________________________________
>> For list-related administrative tasks:
>> http://lists.racket-lang.org/listinfo/dev
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/dev


Posted on the dev mailing list.