I have an app of medium complexity that uses sqlite, with recent racket versions (I think since racket 8.2 maybe 8.1 dot something) while trying to connect to the database I get an error that doesn't give a lot of clues:
invalid memory reference. Some debugging context lost
context...:
.../private/minimatch.rkt:33:17: fail
/usr/share/racket/collects/racket/contract/private/arrow-val-first.rkt:555:3
<<< more of my module stuff here... calling sqlite3-connect >>>
(I started the app with a racket git checkout I had laying around for a while, because I didn't have time to look into the error and it worked with that racket installation (and I thought that maybe I had messed up my other installation somehow), that checkout is version "Welcome to Racket v8.1.0.6 [cs]." commit e032be434e5918b92ee93c571b5531078642524c if it is a bug in racket it might have been introduced after that)
I use libsqlite, so I tried without it and I also get the error.
I tried a bunch of different parameter combinations for sqlite3-connect
, even using a newly created database, nothing changed anything.
Then I tried to create a minimal example as a separate module / project.
And it simply worked, I was puzzled about what is the difference between my example program and my real one?
I debugged my program with the debugger couldn't see anything new,
except then I clicked on stuff in drracket and got this:
(while simply clicking the text editor in drracket)
So that got me thinking, maybe it is some kind of strange interaction between racket/gui and sqlite?
So I found that this program works for me, but fails when I require racket/gui:
#lang racket/base
(require db)
(require racket/gui) ;; comment out this line and it works
(define (test)
(define c (sqlite3-connect #:database 'memory #:mode 'create))
(displayln (query-value c "SELECT sqlite_version();"))
(displayln "done"))
(module+ main
(test))
fail output:
invalid memory reference. Some debugging context lost
context...:
body of (submod "/home/sze/development/workspace/racket_projects/tools/sqlitetest.rkt" main)
working output:
3.36.0
done
If you open the non working program in drracket you get the internal error popup when you click on text, or at least I do with Racket v8.3 [cs]
. Actually it seems the popups only start appearing when you have typed something within the editor.
Can anyone reproduce this error on their machine? I am running manjaro linux, if that matters.
Are there any other needed / helpful things I could post?