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

From: Eric Hanchrow (eric.hanchrow at gmail.com)
Date: Sat Nov 12 19:42:11 EST 2011

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")


Posted on the dev mailing list.