Re: [sqlite] Core dump with python multi thread programming using sqlite3 DB

2019-03-01 Thread Keith Medcalf
On Thursday, 28 February, 2019 21:09, Rishi Mutnuru  
wrote:

>I am developing a Multi threaded solution using sqlite3 DB. I know
>there are some issues
>With SQlite3 and python multithreads.

I have never seen a single multithreading problem with Python and SQLite3, at 
least not for at least the last 5 years or more.  So unless you are using a 
REALLY OLD version of Python and SQLite3 you are unlikely to run into any 
problems whatsoever.

What are the particular issues you are running into?


---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.




___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Core dump with python multi thread programming using sqlite3 DB

2019-03-01 Thread Richard Hipp
On 2/28/19, Rishi Mutnuru  wrote:
> Hi Experts,
> I am developing a Multi threaded solution using sqlite3 DB. I know there are
> some issues
> With SQlite3 and python multithreads.
>
> 1. I compiled libsqlite3 with SQLITE_THREADSAFE=2 so that multiple threads
> can use it.
>  2. I used the APIs threading.Lock(), and lock.acquire(), lock.release() to
> serialize the DB read/update operations.

Segfaults in sqlite3_free() are almost always the result of heap
corruption caused by some other component of the application.  SQLite
just happened to be the unlucky library that first stumbled over the
heap corruption.


-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Core dump with python multi thread programming using sqlite3 DB

2019-03-01 Thread Rishi Mutnuru
Hi Experts,
I am developing a Multi threaded solution using sqlite3 DB. I know there are 
some issues
With SQlite3 and python multithreads.

1. I compiled libsqlite3 with SQLITE_THREADSAFE=2 so that multiple threads can 
use it.
 2. I used the APIs threading.Lock(), and lock.acquire(), lock.release() to 
serialize the DB read/update operations.

After this, I am always getting following segmentation fault. Can you please 
let me know what is going wrong and
Potential fix to this.



*** Error in `python': double free or corruption (!prev): 0x7f5c30b20d30 ***
=== Backtrace: =
/lib64/libc.so.6(+0x814e9)[0x7f5c44ed04e9]
/usr/local/lib/libsqlite3.so.0(sqlite3_free+0x4f)[0x7f5c43165baf]
/usr/local/lib/libsqlite3.so.0(+0x2c1f1)[0x7f5c431711f1]
/usr/local/lib/libsqlite3.so.0(+0x2c287)[0x7f5c43171287]
/usr/local/lib/libsqlite3.so.0(+0x78dc6)[0x7f5c431bddc6]
/usr/local/lib/libsqlite3.so.0(sqlite3_finalize+0x3c)[0x7f5c431bde1c]
/root/.pyenv/versions/2.7.12/lib/python2.7/lib-dynload/_sqlite3.so(pysqlite_statement_finalize+0x21)[0x7f5c4345e7e1]
/root/.pyenv/versions/2.7.12/lib/python2.7/lib-dynload/_sqlite3.so(pysqlite_do_all_statements+0x45)[0x7f5c43459205]
/root/.pyenv/versions/2.7.12/lib/python2.7/lib-dynload/_sqlite3.so(pysqlite_connection_close+0x2e)[0x7f5c43459d3e]
python(PyEval_EvalFrameEx+0x5cab)[0x4b63ab]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalCodeEx+0x7f8)[0x4b9d78]
python[0x52dec0]
python(PyObject_Call+0x3a)[0x422daa]
python[0x42728d]
python(PyObject_Call+0x3a)[0x422daa]
python[0x48136f]
python[0x47ea9a]
python(PyObject_Call+0x3a)[0x422daa]
python(PyEval_EvalFrameEx+0x179a)[0x4b1e9a]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalCodeEx+0x7f8)[0x4b9d78]
python[0x52df8f]
python(PyObject_Call+0x3a)[0x422daa]
python(PyEval_EvalFrameEx+0x1e33)[0x4b2533]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalFrameEx+0x6334)[0x4b6a34]
python(PyEval_EvalCodeEx+0x7f8)[0x4b9d78]
python[0x52dec0]
python(PyObject_Call+0x3a)[0x422daa]
python[0x42728d]
python(PyObject_Call+0x3a)[0x422daa]
python(PyEval_CallObjectWithKeywords+0x47)[0x4b0657]
python[0x4fed42]
/lib64/libpthread.so.0(+0x7dd5)[0x7f5c4592cdd5]
/lib64/libc.so.6(clone+0x6d)[0x7f5c44f4dbfd]
=== Memory map: 
0040-005a6000 r-xp  08:01 668539 
/root/.pyenv/versions/2.7.12/bin/python2.7
007a5000-007a6000 r--p 001a5000 08:01 668539 
/root/.pyenv/versions/2.7.12/bin/python2.7
007a6000-007e2000 rw-p 001a6000 08:01 668539 
/root/.pyenv/versions/2.7.12/bin/python2.7
007e2000-00804000 rw-p  00:00 0 
021d4000-0285f000 rw-p  00:00 0  [heap]
7f5c2800-7f5c29112000 rw-p  00:00 0 
7f5c29112000-7f5c2c00 ---p  00:00 0 
7f5c2c00-7f5c2c021000 rw-p  00:00 0 
7f5c2c021000-7f5c3000 ---p  00:00 0 
7f5c3000-7f5c310fd000 rw-p  00:00 0 
7f5c310fd000-7f5c3400 ---p  00:00 0 
7f5c3400-7f5c350f9000 rw-p  00:00 0 
7f5c350f9000-7f5c3800 ---p  00:00 0 
7f5c3800-7f5c39104000 rw-p  00:00 0 
7f5c39104000-7f5c3c00 ---p  00:00 0 
7f5c3c216000-7f5c3c22b000 r-xp  08:01 133728 
/usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f5c3c22b000-7f5c3c42a000 ---p 00015000 08:01 133728 
/usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f5c3c42a000-7f5c3c42b000 r--p 00014000 08:01 133728 
/usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f5c3c42b000-7f5c3c42c000 rw-p 00015000 08:01 133728 
/usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f5c3c42c000-7f5c3c52c000 rw-p  00:00 0 
7f5c3c52c000-7f5c3c52d000 ---p  00:00 0 
7f5c3c52d000-7f5c3cd2d000 rw-p  00:00 0 
7f5c3cd2d000-7f5c3cd2e000 ---p  00:00 0 
7f5c3cd2e000-7f5c3d52e000 rw-p  00:00 0 
7f5c3d52e000-7f5c3d52f000 ---p  00:00 0 
7f5c3d52f000-7f5c3dd2f000 rw-p  00:00 0 
7f5c3dd2f000-7f5c3dd3 ---p  00:00 0 
7f5c3dd3-7f5c3e63 rw-p  00:00 0 
7f5c3e63-7f5c3e644000 r-xp  08:01 671144 
/root/.pyenv/versions/2.7.12/lib/python2.7/lib-dynload/_ssl.so
7f5c3e644000-7f5c3e843000 ---p 00014000 08:01 671144 
/root/.pyenv/versions/2.7.12/lib/python2.7/lib-dynload/_ssl.so
7f5c3e843000-7f5c3e844000 r--p 00013000 08:01 671144 
/root/.pyenv/versions/2.7.12/lib/python2.7/lib-dynload/_ssl.so
7f5c3e844000-7f5c3e848000 rw-p 00014000 08:01 671144 
/root/.pyenv/versions/2.7.12/lib/python2.7/lib-dynload/_ssl.so
7f5c3e848000-7f5c3e85