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

2011-12-16 Thread Ryan Culpepper
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 2)])
(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

_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/dev


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

2011-11-13 Thread Ryan Culpepper
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 2)])
   (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


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

2011-11-13 Thread Eric Hanchrow
For what it's worth, on OS X the error message is a bit different:  "Seg fault 
(internal error during gc) at 0x0".

On Nov 12, 2011, at 4: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 2)])
>  (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


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

2011-11-13 Thread Rodolfo Carvalho
Eric,

I can't help fixing the problem with your current code, but I can point you
to the docs where Ryan says you should probably use functions like
"start-transaction", "commit-transaction" and "call-with-transaction" (in
case you missed those).

http://docs.racket-lang.org/db/query-api.html?q=db#(part._transactions)
"""
PostgreSQL, MySQL, and SQLite connections are discouraged from using
transaction-changing SQL statements
"""

So, for example, (query-exec db "BEGIN TRANSACTION") becomes (start-transaction
db).


[]'s

Rodolfo Carvalho
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

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

2011-11-12 Thread Eric Hanchrow
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 2)])
  (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