SQLite Forum

Unexpected Assertion Error in SQLite3MemCompare

Unexpected Assertion Error in SQLite3MemCompare

(1) By Jinsheng Ba (bajinsheng) on 2022-06-07 00:26:58 [source]

There is an assertion error that happens at https://github.com/sqlite/sqlite/blob/master/src/vdbeaux.c#L4411

To show the stack trace of the assertion error, we rewrite this line from

assert( pMem1->enc==pMem2->enc || pMem1->db->mallocFailed );
    if( pMem1->enc!=pMem2->enc && !pMem1->db->mallocFailed ) {
and get a Java error report from the SQLite3 JDBC driver.

The stack trace information:

---------------  T H R E A D  ---------------

Current thread (0x00007fe1289a7000):  JavaThread "database6" [_thread_in_native, id=3525704, stack(0x00007fe0adc45000,0x00007fe0add46000)]

Stack: [0x00007fe0adc45000,0x00007fe0add46000],  sp=0x00007fe0add42680,  free space=1013k

Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)

C  [sqlite-3.39.0-21882545-66a5-481d-836f-31d727365498-libsqlitejdbc.so+0x5ed84]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)

J 1415  org.sqlite.core.NativeDB.prepare_utf8([B)J (0 bytes) @ 0x00007fe1184dbb9c [0x00007fe1184dbb40+0x000000000000005c]

J 2332 c2 org.sqlite.core.NativeDB.prepare(Ljava/lang/String;)J (9 bytes) @ 0x00007fe1185876e8 [0x00007fe1185874e0+0x0000000000000208]

J 2333 c2 org.sqlite.core.DB.prepare(Lorg/sqlite/core/CoreStatement;)V (65 bytes) @ 0x00007fe11858cd0c [0x00007fe11858cc40+0x00000000000000cc]

The full Java error report is here: https://docs.google.com/document/d/1MBCZdLl9PcDYxjcv_fb5cCAUdvQg8ATm1xFi-SvOWnk/edit?usp=sharing

The full log of all executed sql statements is here: https://drive.google.com/file/d/1ghnqTMUGuP92LRl-NX0GC3rytfWmthse/view?usp=sharing


Version: 3.39.0

Commit ID: d18818af

OS: Ubuntu 20.04

Configuration Options: ./configure --enable-all --enable-debug

Compiler: clang-10

(2.1) By Jinsheng Ba (bajinsheng) on 2022-06-07 12:43:43 edited from 2.0 in reply to 1 [link] [source]

We also would like to highlight that the assertion error can not be reproduced by the log file of all saved sql statements in CLI mode. We have not figured out the reason, but it always happen in the JDBC driver.

(3) By Richard Hipp (drh) on 2022-06-07 09:34:05 in reply to 2.0 [link] [source]

I'm able to reproduce the problem, thanks. I'm testing the fix now.

(4) By Richard Hipp (drh) on 2022-06-07 10:14:55 in reply to 3 [link] [source]

Should be fixed now on trunk.

(5) By Jinsheng Ba (bajinsheng) on 2022-06-07 12:43:55 in reply to 4 [link] [source]