[go-nuts] gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Tamás Gulácsi
It's quite straightforward: gwenn/gosqlite has an error, by passing a Go 
pointer to the C side. This check is in effect since Go1.6.

You should try to refresh your gosqlite library, or find a better maintained 
one.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] gwenn/gosqlite, go1.8, runtime error: cgo argument has Go pointer to Go pointer

2017-03-08 Thread Basile Starynkevitch
Hello list,

It is about my (github-ed) monimelt  
(MELT monitor, in early pre-alpha stage) specifically about its commit 
44434cd991c 

 
which has some README.md 
 giving build 
instructions; I'm getting a reproducible bug that I don't understand, but I 
am still a newbie in Go.
I'm using go1.8 on Debian/Linux/Sid/x86-64 and I am building with gb 
 (not with go build). The driving idea at first is to 
persist, in sqlite database using some JSON format, the entire heap -of 
some Scheme-like "interpreter"- made of "objects" or "items" and values.

To reproduce my bug, follow my build instructions (essentially, how to use 
gb to build my MELT monitor) then run

./bin/monimelt -final-dump-dir /tmp/


What should happen is that the /tmp/ directory (of course you can 
replace that by any fresh path in /tmp or elsewhere) should be created and 
filled with two (almost empty) sqlite databases.
Actually I am creating temporary files in that directory, with some *random* 
suffix like e.g. +_9l7UhTyyJFx_p6950.tmp (of course when you'll run it 
you'll get *another* random suffix) and I want to rename these temporary 
files when at end of dump.


What is really happening is strange (and reproducible): 
2017/03/08 10:19:35 persist-init installed sqliteerrorlogmo
Monimelt starting pid 6950, Go version go1.8
2017/03/08 10:19:35 monimelt should final dump in /tmp/
2017/03/08 10:19:35 OpenDumperDirectory dirpath=/tmp/ dtempsuf=+
_9l7UhTyyJFx_p6950.tmp
2017/03/08 10:19:35 create_table globflag=true dir=/tmp/
2017/03/08 10:19:35 create_table db=&{0xc420018530 file:/tmp//
monimelt_state.sqlite+_9l7UhTyyJFx_p6950.tmp?mode=rwc=private 0 {0 0} 
[] map[] 0 0 0xc420016480 false map[] map[] 0 0 0 } sql_create_t_params
="CREATE TABLE IF NOT EXISTS t_params \n (par_name VARCHAR(35) PRIMARY KEY 
ASC NOT NULL UNIQUE, \n  par_value TEXT NOT NULL);"
panic: runtime error: cgo argument has Go pointer to Go pointer

goroutine 1 [running]:
github.com/gwenn/gosqlite.(*Conn).ProgressHandler.func2(0x162b488, 
0xc40064, 0xc42000c940)
/home/basile/Documents/monimelt/vendor/src/github.com/gwenn/gosqlite/
trace.go:315 +0x8b
github.com/gwenn/gosqlite.(*Conn).ProgressHandler(0xc42009a640, 0x5833f8, 
0x164, 0x558460, 0xc420018440)
/home/basile/Documents/monimelt/vendor/src/github.com/gwenn/gosqlite/
trace.go:316 +0x117
github.com/gwenn/gosqlite.(*conn).ExecContext(0xc42000e060, 0x8255e0, 
0xc420018440, 0x582e9f, 0x79, 0x851af8, 0x0, 0x0, 0x0, 0x0, ...)
/home/basile/Documents/monimelt/vendor/src/github.com/gwenn/gosqlite/
driver.go:143 +0xcb
database/sql.ctxDriverExec(0x8255e0, 0xc420018440, 0x7fb37ce4e198, 
0xc42000e060, 0x582e9f, 0x79, 0x851af8, 0x0, 0x0, 0x42c0ae, ...)
/usr/local/go/src/database/sql/ctxutil.go:31 +0x28d
database/sql.(*DB).exec.func2()
/usr/local/go/src/database/sql/sql.go:1199 +0x99
database/sql.withLock(0x824ae0, 0xc42001a9a0, 0xc42004b6c0)
/usr/local/go/src/database/sql/sql.go:2545 +0x65
database/sql.(*DB).exec(0xc42009a460, 0x8255e0, 0xc420018440, 0x582e9f, 0x79
, 0x0, 0x0, 0x0, 0x101, 0x0, ...)
/usr/local/go/src/database/sql/sql.go:1200 +0x51c
database/sql.(*DB).ExecContext(0xc42009a460, 0x8255e0, 0xc420018440, 
0x582e9f, 0x79, 0x0, 0x0, 0x0, 0x145, 0x0, ...)
/usr/local/go/src/database/sql/sql.go:1165 +0xbc
database/sql.(*DB).Exec(0xc42009a460, 0x582e9f, 0x79, 0x0, 0x0, 0x0, 0xa0, 
0xc42009a500, 0x0, 0x834a80)
/usr/local/go/src/database/sql/sql.go:1179 +0x85
objvalmo.DumperMo.create_tables(0x0, 0x7ffc2316b893, 0x9, 0xc42000c900, 0x17
, 0xc42009a460, 0xc42009a500, 0x0, 0x0, 0x0, ...)
/home/basile/Documents/monimelt/src/objvalmo/persist.go:208 +0x240
objvalmo.OpenDumperDirectory(0x7ffc2316b893, 0x9, 0x0)
/home/basile/Documents/monimelt/src/objvalmo/persist.go:306 +0xb8b
objvalmo.DumpIntoDirectory(0x7ffc2316b893, 0x9)
/home/basile/Documents/monimelt/src/objvalmo/persist.go:534 +0x39
main.main()
/home/basile/Documents/monimelt/src/monimelt/monimelt.go:38 +0x8df


Now, here is my *partial* understanding of the issue.I suspect I have some 
bug in my code (but then I don't understand where), but it could be 
outside. Maybe it is related to the order of running the various init 
functions (and I don't understand that order, and I don't know how to order 
these initializations). Mayb the bug is elsewhere.

First, *I really need sqlite logging facilities*. So I need the C function 
sqlite3_config  to be called very 
early with SQLITE_CONFIG_LOG 
 and a function 
which justs log verbosely the error. The reason I need sqlite logging is 
that I sometimes am making stupid SQL mistakes, and that logging gives 
verbose enough messages to help me a lot.

So I