Re: [sqlite] Segmentation Fault With Trigger
techi eth wrote: You should compile your code & sqlite3.c with -g -O0 when sending a stack trace. Most likely, the bug is in your program. Since you're on Linux, try running with valgrind memcheck tool to find bugs (access to free memory, uninitialized memory, etc.) If you compile with clang-3.3 or newer, or gcc-4.8.* or newer, you can also compile & link with -fsanitize=address to find bugs (much quicker than using valgrind if your program is slow). But the best is to try both (valgrind & gcc/clang address sanitizer, not at the same time) since they can find different bugs: * only valgrind will find uninitialized memory access * only the address sanitizer will find global and stack overflows * both will find other kind of errors (double free, use of freed memory...) Dominique > Please provide me hint to solve the issue. > > > Thanks.. > > > On Fri, Oct 11, 2013 at 7:58 PM, techi eth wrote: > >> It is giving same trace what i have sent last time. >> >> It is possible by some one to send test code snapshot of scenario of >> selecting user defined function while trigger execution. >> >> Thanks a lot... >> >> >> On Fri, Oct 11, 2013 at 7:41 PM, Richard Hipp wrote: >> >>> On Fri, Oct 11, 2013 at 10:06 AM, techi eth wrote: >>> >>> > Please provide some hint. >>> > >>> >>> Recompile with -O0 and -g and then post the stack trace after the >>> segfault. >>> >>> -- >>> D. Richard Hipp >>> d...@sqlite.org >>> ___ >>> sqlite-users mailing list >>> sqlite-users@sqlite.org >>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >>> >> >> > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Segmentation Fault With Trigger
I'm not an sqlite3 dev, but I don't think you'll get much help until you provide enough information for somebody to see what is going wrong. You were already asked to provide a backtrace from a debug-compiled sqlite3 library (the backtrace you sent is all but useless). A self-contained .c file that demonstrates the problem would be even better. For example, without knowing what your user-defined function does, we have to assume it is full of memory corruption bugs that cause the problems you experience. Ryan On 15/10/2013 12:12 AM, techi eth wrote: Please provide me hint to solve the issue. Thanks.. On Fri, Oct 11, 2013 at 7:58 PM, techi eth wrote: It is giving same trace what i have sent last time. It is possible by some one to send test code snapshot of scenario of selecting user defined function while trigger execution. Thanks a lot... On Fri, Oct 11, 2013 at 7:41 PM, Richard Hipp wrote: On Fri, Oct 11, 2013 at 10:06 AM, techi eth wrote: Please provide some hint. Recompile with -O0 and -g and then post the stack trace after the segfault. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Segmentation Fault With Trigger
Please provide me hint to solve the issue. Thanks.. On Fri, Oct 11, 2013 at 7:58 PM, techi eth wrote: > It is giving same trace what i have sent last time. > > It is possible by some one to send test code snapshot of scenario of > selecting user defined function while trigger execution. > > Thanks a lot... > > > On Fri, Oct 11, 2013 at 7:41 PM, Richard Hipp wrote: > >> On Fri, Oct 11, 2013 at 10:06 AM, techi eth wrote: >> >> > Please provide some hint. >> > >> >> Recompile with -O0 and -g and then post the stack trace after the >> segfault. >> >> -- >> D. Richard Hipp >> d...@sqlite.org >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Segmentation Fault With Trigger
It is giving same trace what i have sent last time. It is possible by some one to send test code snapshot of scenario of selecting user defined function while trigger execution. Thanks a lot... On Fri, Oct 11, 2013 at 7:41 PM, Richard Hipp wrote: > On Fri, Oct 11, 2013 at 10:06 AM, techi eth wrote: > > > Please provide some hint. > > > > Recompile with -O0 and -g and then post the stack trace after the segfault. > > -- > D. Richard Hipp > d...@sqlite.org > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Segmentation Fault With Trigger
Data Info is not an problem.I am passing data information for building query before passing to sqlite exec function.If i remove trigger for insert then my code is working perfectly fine. My assumption is it is due to selecting function during trigger.Please suggest hint by looking sequence provide by me. Thanks On Fri, Oct 11, 2013 at 7:41 PM, Stephan Beal wrote: > On Fri, Oct 11, 2013 at 4:06 PM, techi eth wrote: > > > > #4 0x778e1127 in SqliteTestInsert (SQLitePrivate=0x602300, > > > TableName_p=0x4019a0 "dbTestTbl", DataInfoList=0x4) > > > > There's the problem: DataInfoList is an invalid pointer. i have no idea > what that is, but it's not part of sqlite3's sources. > > -- > - stephan beal > http://wanderinghorse.net/home/stephan/ > http://gplus.to/sgbeal > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Segmentation Fault With Trigger
On Fri, Oct 11, 2013 at 4:06 PM, techi eth wrote: > > #4 0x778e1127 in SqliteTestInsert (SQLitePrivate=0x602300, > > TableName_p=0x4019a0 "dbTestTbl", DataInfoList=0x4) > There's the problem: DataInfoList is an invalid pointer. i have no idea what that is, but it's not part of sqlite3's sources. -- - stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Segmentation Fault With Trigger
On Fri, Oct 11, 2013 at 10:06 AM, techi eth wrote: > Please provide some hint. > Recompile with -O0 and -g and then post the stack trace after the segfault. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Segmentation Fault With Trigger
Please provide some hint.I have added some more details about function definition & query. /* Create function definition */ static void Test(sqlite3_context *context, int argc, sqlite3_value **argv) { printf ("Trigger Function Called\n"); if (argc == 1) { char *text = sqlite3_value_text(argv[0]); if (text && text[0]) { char result[2]; result[0] = text[0]; result[1] = '\0'; sqlite3_result_text(context, result, -1, SQLITE_TRANSIENT); return; } } sqlite3_result_null(context); } /*Create Function */ sqlite3_create_function(Handler, "Test",1, SQLITE_UTF8, NULL, &Test, NULL, NULL); /*Create Trigger Query */ create trigger TestTrigger after insert on dbTestTbl for each row begin SELECT Test (new.RowId) from dbTestTbl; end; On Fri, Oct 11, 2013 at 5:55 PM, techi eth wrote: > Please find below : > > #0 0x7fffe0b8 in ?? () > > #1 0x776988f6 in ?? () from > /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 > > #2 0x7769e451 in sqlite3_step () from > /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 > > #3 0x776a1e4c in sqlite3_exec () from > /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 > > #4 0x778e1127 in SqliteTestInsert (SQLitePrivate=0x602300, > TableName_p=0x4019a0 "dbTestTbl", DataInfoList=0x4) > > #5 0x00400d58 in TEST_SqliteTestInsert (RowID=) at > sqlite3_test.c:340 > > #6 main (argc=, args=) at sqlite3_test.c:922 > > Thanks > > > On Fri, Oct 11, 2013 at 5:35 PM, Richard Hipp wrote: > >> On Fri, Oct 11, 2013 at 7:57 AM, techi eth wrote: >> >> > Hi, >> > >> > I am getting segmentation fault while executing query in sqlite3. [Linux >> > OS]. >> > >> >> Can you send us a stack trace? >> >> >> > >> > Find below sequence. >> > >> > // Getting SQLiteHandler >> > >> > OpenConnection (); >> > >> > //Creating user defined function “Test” >> > >> > sqlite3_create_function(SQLiteHandler, "Test",1, SQLITE_UTF8, NULL, >> &Test, >> > NULL, NULL) >> > >> > //Creating table,Below is DDL >> > >> > CREATE TABLE dbTestTbl ( >> > >> > RowID INTEGER PRIMARY KEY AUTOINCREMENT, >> > >> > ParamaterID INTEGER, >> > >> > ParamaterValue TEXT >> > >> > ); >> > >> > //Createatd Trigger,Below is DDL >> > >> > CREATE TRIGGER TestTrigger >> > >> >AFTER INSERT ON dbTestTbl >> > >> >FOR EACH ROW >> > >> > BEGIN >> > >> > SELECT Test( RowID ) >> > >> > FROM dbTestTbl; >> > >> > END; >> > >> > // INSERT INTO dbTestTbl >> > >> > Please suggest what is wrong defined here. >> > >> > Thanks >> > ___ >> > sqlite-users mailing list >> > sqlite-users@sqlite.org >> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > >> >> >> >> -- >> D. Richard Hipp >> d...@sqlite.org >> ___ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Segmentation Fault With Trigger
Please find below : #0 0x7fffe0b8 in ?? () #1 0x776988f6 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #2 0x7769e451 in sqlite3_step () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #3 0x776a1e4c in sqlite3_exec () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #4 0x778e1127 in SqliteTestInsert (SQLitePrivate=0x602300, TableName_p=0x4019a0 "dbTestTbl", DataInfoList=0x4) #5 0x00400d58 in TEST_SqliteTestInsert (RowID=) at sqlite3_test.c:340 #6 main (argc=, args=) at sqlite3_test.c:922 Thanks On Fri, Oct 11, 2013 at 5:35 PM, Richard Hipp wrote: > On Fri, Oct 11, 2013 at 7:57 AM, techi eth wrote: > > > Hi, > > > > I am getting segmentation fault while executing query in sqlite3. [Linux > > OS]. > > > > Can you send us a stack trace? > > > > > > Find below sequence. > > > > // Getting SQLiteHandler > > > > OpenConnection (); > > > > //Creating user defined function “Test” > > > > sqlite3_create_function(SQLiteHandler, "Test",1, SQLITE_UTF8, NULL, > &Test, > > NULL, NULL) > > > > //Creating table,Below is DDL > > > > CREATE TABLE dbTestTbl ( > > > > RowID INTEGER PRIMARY KEY AUTOINCREMENT, > > > > ParamaterID INTEGER, > > > > ParamaterValue TEXT > > > > ); > > > > //Createatd Trigger,Below is DDL > > > > CREATE TRIGGER TestTrigger > > > >AFTER INSERT ON dbTestTbl > > > >FOR EACH ROW > > > > BEGIN > > > > SELECT Test( RowID ) > > > > FROM dbTestTbl; > > > > END; > > > > // INSERT INTO dbTestTbl > > > > Please suggest what is wrong defined here. > > > > Thanks > > ___ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > > > > -- > D. Richard Hipp > d...@sqlite.org > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Segmentation Fault With Trigger
On Fri, Oct 11, 2013 at 7:57 AM, techi eth wrote: > Hi, > > I am getting segmentation fault while executing query in sqlite3. [Linux > OS]. > Can you send us a stack trace? > > Find below sequence. > > // Getting SQLiteHandler > > OpenConnection (); > > //Creating user defined function “Test” > > sqlite3_create_function(SQLiteHandler, "Test",1, SQLITE_UTF8, NULL, &Test, > NULL, NULL) > > //Creating table,Below is DDL > > CREATE TABLE dbTestTbl ( > > RowID INTEGER PRIMARY KEY AUTOINCREMENT, > > ParamaterID INTEGER, > > ParamaterValue TEXT > > ); > > //Createatd Trigger,Below is DDL > > CREATE TRIGGER TestTrigger > >AFTER INSERT ON dbTestTbl > >FOR EACH ROW > > BEGIN > > SELECT Test( RowID ) > > FROM dbTestTbl; > > END; > > // INSERT INTO dbTestTbl > > Please suggest what is wrong defined here. > > Thanks > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Segmentation Fault With Trigger
Hi, I am getting segmentation fault while executing query in sqlite3. [Linux OS]. Find below sequence. // Getting SQLiteHandler OpenConnection (); //Creating user defined function “Test” sqlite3_create_function(SQLiteHandler, "Test",1, SQLITE_UTF8, NULL, &Test, NULL, NULL) //Creating table,Below is DDL CREATE TABLE dbTestTbl ( RowID INTEGER PRIMARY KEY AUTOINCREMENT, ParamaterID INTEGER, ParamaterValue TEXT ); //Createatd Trigger,Below is DDL CREATE TRIGGER TestTrigger AFTER INSERT ON dbTestTbl FOR EACH ROW BEGIN SELECT Test( RowID ) FROM dbTestTbl; END; // INSERT INTO dbTestTbl Please suggest what is wrong defined here. Thanks ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users