Skip to content

TestVFS FAIL with memgrind

Thinking about #120 (closed) I tried to run the tests with -tags=libc.memgrind. That unearthed a memory management failure. I have yet to verify/confirm if it's an artefact of the qemu VM or not. If it is confirmed, it has to be fixed. It may be connected to #120 (closed), but not neccessarily.

jnml@linux-s390x:~/src/modernc.org/sqlite$ rm -f nohup.out ; nohup go test -v -timeout 196h -tags=libc.memgrind &
[1] 353
jnml@linux-s390x:~/src/modernc.org/sqlite$ nohup: ignoring input and appending output to 'nohup.out'

jnml@linux-s390x:~/src/modernc.org/sqlite$ tail -f nohup.out 
test binary compiled for linux/s390x
=== RUN   TestIssue118
--- PASS: TestIssue118 (122.79s)
=== RUN   TestIssue100
--- PASS: TestIssue100 (0.02s)
=== RUN   TestIssue98
--- PASS: TestIssue98 (0.08s)
=== RUN   TestIssue97
--- PASS: TestIssue97 (0.05s)
=== RUN   TestScalar
--- PASS: TestScalar (0.06s)
=== RUN   TestRedefineUserDefinedFunction
--- PASS: TestRedefineUserDefinedFunction (0.01s)
=== RUN   TestRegexpUserDefinedFunction
=== RUN   TestRegexpUserDefinedFunction/regexp_filter
=== RUN   TestRegexpUserDefinedFunction/regexp_matches
=== RUN   TestRegexpUserDefinedFunction/regexp_does_not_match
=== RUN   TestRegexpUserDefinedFunction/errors_on_bad_regexp
=== RUN   TestRegexpUserDefinedFunction/errors_on_bad_first_argument
=== RUN   TestRegexpUserDefinedFunction/errors_on_bad_second_argument
--- PASS: TestRegexpUserDefinedFunction (0.08s)
    --- PASS: TestRegexpUserDefinedFunction/regexp_filter (0.05s)
    --- PASS: TestRegexpUserDefinedFunction/regexp_matches (0.00s)
    --- PASS: TestRegexpUserDefinedFunction/regexp_does_not_match (0.00s)
    --- PASS: TestRegexpUserDefinedFunction/errors_on_bad_regexp (0.00s)
    --- PASS: TestRegexpUserDefinedFunction/errors_on_bad_first_argument (0.00s)
    --- PASS: TestRegexpUserDefinedFunction/errors_on_bad_second_argument (0.00s)
=== RUN   TestBlob
--- PASS: TestBlob (0.05s)
=== RUN   TestIssue11
--- PASS: TestIssue11 (1.08s)
=== RUN   TestMemDB
--- PASS: TestMemDB (22.56s)
=== RUN   TestConcurrentGoroutines
    all_test.go:952: 8 goroutines concurrently inserted 40000 rows in 7.597330093s
--- PASS: TestConcurrentGoroutines (8.04s)
=== RUN   TestConcurrentProcesses
exec: ./mptest db config01.test
    all_test.go:1059: config01.test: Summary: 0 errors out of 163 tests
exec: ./mptest db config02.test
    all_test.go:1059: config02.test: Summary: 0 errors out of 627 tests
exec: ./mptest db crash01.test
    all_test.go:1059: crash01.test: Summary: 0 errors out of 0 tests
exec: ./mptest db multiwrite01.test
    all_test.go:1059: multiwrite01.test: Summary: 0 errors out of 81 tests
--- PASS: TestConcurrentProcesses (565.43s)
=== RUN   TestIssue19
--- PASS: TestIssue19 (0.16s)
=== RUN   TestIssue20
--- PASS: TestIssue20 (2.96s)
=== RUN   TestNoRows
--- PASS: TestNoRows (0.05s)
=== RUN   TestColumns
--- PASS: TestColumns (0.02s)
=== RUN   TestColumnsNoRows
--- PASS: TestColumnsNoRows (0.01s)
=== RUN   TestIssue28
--- PASS: TestIssue28 (0.03s)
=== RUN   TestColumnTypes
    all_test.go:1446: Col 0: DatabaseTypeName "INTEGER", DecimalSize 0 0 false, Length 0 false, Name "uid", Nullable true true, ScanType "int64"
        Col 1: DatabaseTypeName "VARCHAR(64)", DecimalSize 0 0 false, Length 9223372036854775807 true, Name "username", Nullable true true, ScanType "string"
        Col 2: DatabaseTypeName "VARCHAR(64)", DecimalSize 0 0 false, Length 9223372036854775807 true, Name "departname", Nullable true true, ScanType "string"
        Col 3: DatabaseTypeName "DATE", DecimalSize 0 0 false, Length 9223372036854775807 true, Name "created", Nullable true true, ScanType "string"
        
--- PASS: TestColumnTypes (0.07s)
=== RUN   TestColumnTypesNoRows
    all_test.go:1509: Col 0: DatabaseTypeName "INTEGER", DecimalSize 0 0 false, Length 0 false, Name "uid", Nullable true true, ScanType %!q(<nil>)
        Col 1: DatabaseTypeName "VARCHAR(64)", DecimalSize 0 0 false, Length 0 false, Name "username", Nullable true true, ScanType %!q(<nil>)
        Col 2: DatabaseTypeName "VARCHAR(64)", DecimalSize 0 0 false, Length 0 false, Name "departname", Nullable true true, ScanType %!q(<nil>)
        Col 3: DatabaseTypeName "DATE", DecimalSize 0 0 false, Length 0 false, Name "created", Nullable true true, ScanType %!q(<nil>)
        
--- PASS: TestColumnTypesNoRows (0.03s)
=== RUN   TestTime
--- PASS: TestTime (0.06s)
=== RUN   TestTimeScan
--- PASS: TestTimeScan (0.21s)
=== RUN   TestTimeLocaltime
--- PASS: TestTimeLocaltime (0.01s)
=== RUN   TestTimeFormat
=== RUN   TestTimeFormat/#00
=== RUN   TestTimeFormat/#01
--- PASS: TestTimeFormat (0.02s)
    --- PASS: TestTimeFormat/#00 (0.01s)
    --- PASS: TestTimeFormat/#01 (0.01s)
=== RUN   TestTimeFormatBad
--- PASS: TestTimeFormatBad (0.00s)
=== RUN   TestBinding
=== RUN   TestBinding/DB
=== RUN   TestBinding/Prepare
--- PASS: TestBinding (0.02s)
    --- PASS: TestBinding/DB (0.01s)
    --- PASS: TestBinding/Prepare (0.01s)
=== RUN   TestBindingError
=== RUN   TestBindingError/DB
=== RUN   TestBindingError/Prepare
--- PASS: TestBindingError (0.02s)
    --- PASS: TestBindingError/DB (0.01s)
    --- PASS: TestBindingError/Prepare (0.01s)
=== RUN   TestIssue51
    all_test.go:1921: cycles: 2098
    all_test.go:1927: DB records: 2098
--- PASS: TestIssue51 (60.07s)
=== RUN   TestIssue53
--- PASS: TestIssue53 (6.31s)
=== RUN   TestPersistPragma
--- PASS: TestPersistPragma (0.08s)
=== RUN   TestInMemory
--- PASS: TestInMemory (0.03s)
=== RUN   TestIssue70
--- PASS: TestIssue70 (0.01s)
=== RUN   TestIssue66
    all_test.go:2356: insert 2: database is locked (5) (SQLITE_BUSY)
--- PASS: TestIssue66 (0.06s)
=== RUN   TestIssue65
    all_test.go:2458: readFunc(true): read error: database is locked (5) (SQLITE_BUSY)
--- PASS: TestIssue65 (3.00s)
=== RUN   TestConstraintPrimaryKeyError
--- PASS: TestConstraintPrimaryKeyError (0.01s)
=== RUN   TestConstraintUniqueError
--- PASS: TestConstraintUniqueError (0.01s)
=== RUN   TestBeginMode
=== RUN   TestBeginMode/delete/deferred
=== RUN   TestBeginMode/wal/deferred
=== RUN   TestBeginMode/delete/immediate
=== RUN   TestBeginMode/wal/immediate
=== RUN   TestBeginMode/delete/exclusive
=== RUN   TestBeginMode/wal/exclusive
--- PASS: TestBeginMode (0.10s)
    --- PASS: TestBeginMode/delete/deferred (0.01s)
    --- PASS: TestBeginMode/wal/deferred (0.02s)
    --- PASS: TestBeginMode/delete/immediate (0.01s)
    --- PASS: TestBeginMode/wal/immediate (0.03s)
    --- PASS: TestBeginMode/delete/exclusive (0.01s)
    --- PASS: TestBeginMode/wal/exclusive (0.02s)
=== RUN   TestCancelRace
=== RUN   TestCancelRace/db.ExecContext
=== RUN   TestCancelRace/db.QueryContext
=== RUN   TestCancelRace/tx.ExecContext
=== RUN   TestCancelRace/tx.QueryContext
--- PASS: TestCancelRace (0.54s)
    --- PASS: TestCancelRace/db.ExecContext (0.02s)
    --- PASS: TestCancelRace/db.QueryContext (0.05s)
    --- PASS: TestCancelRace/tx.ExecContext (0.21s)
    --- PASS: TestCancelRace/tx.QueryContext (0.23s)
=== RUN   TestVFS
    all_test.go:2758: [1 2 3 40 50 60]
    all_test.go:2780: [123 xyz abc def]
--- FAIL: TestVFS (0.02s)
panic: /home/jnml/src/modernc.org/sqlite/vfs/patches.go:220:Close: free of unallocated memory: 0x3ff742fb128
	panic: /home/jnml/src/modernc.org/sqlite/vfs/patches.go:220:Close: free of unallocated memory: 0x3ff742fb028 [recovered]
	panic: /home/jnml/src/modernc.org/sqlite/vfs/patches.go:220:Close: free of unallocated memory: 0x3ff742fb028

goroutine 20553 [running]:
testing.tRunner.func1.2({0x812800, 0xc0000277f0})
	/usr/local/go/src/testing/testing.go:1526 +0x2e8
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1529 +0x406
panic({0x812800, 0xc0000277f0})
	/usr/local/go/src/runtime/panic.go:884 +0x23a
modernc.org/libc.Xfree(0xc00013c2a0, 0x3ff742fb028)
	/home/jnml/pkg/mod/modernc.org/libc@v1.22.3/memgrind.go:227 +0x33a
modernc.org/sqlite/vfs.(*FS).Close(0xc000105540)
	/home/jnml/src/modernc.org/sqlite/vfs/patches.go:220 +0x126
modernc.org/sqlite.TestVFS.func1()
	/home/jnml/src/modernc.org/sqlite/all_test.go:2710 +0x3c
panic({0x812800, 0xc000027790})
	/usr/local/go/src/runtime/panic.go:884 +0x23a
modernc.org/libc.Xfree(0xc00013c310, 0x3ff742fb128)
	/home/jnml/pkg/mod/modernc.org/libc@v1.22.3/memgrind.go:227 +0x33a
modernc.org/sqlite/vfs.(*FS).Close(0xc000105580)
	/home/jnml/src/modernc.org/sqlite/vfs/patches.go:220 +0x126
modernc.org/sqlite.TestVFS.func2()
	/home/jnml/src/modernc.org/sqlite/all_test.go:2721 +0x3c
modernc.org/sqlite.TestVFS(0xc00007ba00)
	/home/jnml/src/modernc.org/sqlite/all_test.go:2784 +0xdc4
testing.tRunner(0xc00007ba00, 0xc09e88)
	/usr/local/go/src/testing/testing.go:1576 +0x128
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1629 +0x50a
exit status 2
FAIL	modernc.org/sqlite	794.495s