Re: [sqlite] crash at sqlite3DbMallocRawNN

2019-08-20 Thread Richard Hipp
Faults in the memory allocation routines of SQLite are almost always
due to heap corruption caused by other unrelated parts of the
application.  In other words, some other part of the application is
misusing the memory heap, and SQLite merely has the misfortune of
being the first innocent party to stumble over the damage.

I recommend you run your application using Valgrind.  Or, recompile
using -fsanitize=memory.  That will likely pinpoint the source of the
trouble.

On 8/20/19, HA Thi Tham  wrote:
> Hi,
>
> I have a crash at sqlite when reading a row in database (detailed
> stacktrace in the attachment). It happens rarely in our customer machine.
> We cannot reproduce it.
>
> Can you please give some suggestions when this can happen and maybe how to
> fix it.
>
> FAULTING_SOURCE_LINE:
> c:\jenkins\workspace\cortexv2-dev-win64-service-release\src\thirdparty\couchbase-lite-core-ee\encryption\see-sqlite.c
>
> FAULTING_SOURCE_FILE:
> c:\jenkins\workspace\cortexv2-dev-win64-service-release\src\thirdparty\couchbase-lite-core-ee\encryption\see-sqlite.c
>
> FAULTING_SOURCE_CODE:
>  27014:   p = sqlite3Malloc(n);
>  27015:   sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
>  27016:   return p;
>  27017: }
>>27018: SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){
>  27019: #ifndef SQLITE_OMIT_LOOKASIDE
>  27020:   LookasideSlot *pBuf;
>  27021:   assert( db!=0 );
>  27022:   assert( sqlite3_mutex_held(db->mutex) );
>  27023:   assert( db->pnBytesFreed==0 );
>
>
> Thanks in advance!
>
> Tham
>


-- 
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


Re: [sqlite] crash at sqlite3DbMallocRawNN

2019-09-18 Thread HA Thi Tham
Hi Richard,

Thanks for the tips.
I'll base on that to investigate on my app.

Regards, Tham

On Tue, Aug 20, 2019 at 8:18 PM Richard Hipp  wrote:

> Faults in the memory allocation routines of SQLite are almost always
> due to heap corruption caused by other unrelated parts of the
> application.  In other words, some other part of the application is
> misusing the memory heap, and SQLite merely has the misfortune of
> being the first innocent party to stumble over the damage.
>
> I recommend you run your application using Valgrind.  Or, recompile
> using -fsanitize=memory.  That will likely pinpoint the source of the
> trouble.
>
> On 8/20/19, HA Thi Tham  wrote:
> > Hi,
> >
> > I have a crash at sqlite when reading a row in database (detailed
> > stacktrace in the attachment). It happens rarely in our customer machine.
> > We cannot reproduce it.
> >
> > Can you please give some suggestions when this can happen and maybe how
> to
> > fix it.
> >
> > FAULTING_SOURCE_LINE:
> >
> c:\jenkins\workspace\cortexv2-dev-win64-service-release\src\thirdparty\couchbase-lite-core-ee\encryption\see-sqlite.c
> >
> > FAULTING_SOURCE_FILE:
> >
> c:\jenkins\workspace\cortexv2-dev-win64-service-release\src\thirdparty\couchbase-lite-core-ee\encryption\see-sqlite.c
> >
> > FAULTING_SOURCE_CODE:
> >  27014:   p = sqlite3Malloc(n);
> >  27015:   sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
> >  27016:   return p;
> >  27017: }
> >>27018: SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){
> >  27019: #ifndef SQLITE_OMIT_LOOKASIDE
> >  27020:   LookasideSlot *pBuf;
> >  27021:   assert( db!=0 );
> >  27022:   assert( sqlite3_mutex_held(db->mutex) );
> >  27023:   assert( db->pnBytesFreed==0 );
> >
> >
> > Thanks in advance!
> >
> > Tham
> >
>
>
> --
> 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