Re: [sqlite] Cross-compiled sqlite3 tool runs into segmentation fault when creating a table

2011-12-15 Thread imin imup
On Mon, Dec 12, 2011 at 10:41 PM, Richard Hipp  wrote:

> On Mon, Dec 12, 2011 at 11:34 PM, imin imup  wrote:
>
> >  Hello,
> >
> > I'm cross-compiling SQLite 3.6.12 onto Fedora 14 on MIPS cpu. The command
> > line tool sqlite3 runs into segmentation fault when I tried to create a
> > table:
> >
> >
> > # sqlite3_mipsel test.db
> > SQLite version 3.6.12
> > Enter ".help" for instructions
> > Enter SQL statements terminated with a ";"
> > sqlite> create table tbl1(one varchar(10), two smallint);
> > Segmentation fault
> >
> >
> > Any idea how to fix this?
> >
>
> Compile the following patch instead:
> http://www.sqlite.org/src/ci/54cc119811?sbs=0
>
> It works! Tons of thanks!
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Cross-compiled sqlite3 tool runs into segmentation fault when creating a table

2011-12-12 Thread imin imup
 Hello,

I'm cross-compiling SQLite 3.6.12 onto Fedora 14 on MIPS cpu. The command
line tool sqlite3 runs into segmentation fault when I tried to create a
table:


# sqlite3_mipsel test.db
SQLite version 3.6.12
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table tbl1(one varchar(10), two smallint);
Segmentation fault


Any idea how to fix this?
It runs well on Fedora14 on i386 CPU.


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


Re: [sqlite] sqlite error: database is locked

2010-03-17 Thread imin imup
> Thanks for clarification. I assumed the error message of error code

> > SQLITE_BUSY is something like "databased is busy".
>
> http://www.sqlite.org/c3ref/c_abort.html
> Also in sqlite3.h file - comments on the right are almost exactly
> reflect the corresponding error message.
>

You are totally right.


>
> > Another newbie question. Is it safe for 2 threads to share 1 connection
> when
> > the connection is protected by my own mutex?
>
> Sure, everything protected by mutex can be considered executing in one
> thread and thus is never prone to multi-threading issues.
>
> Thanks for pointing out, very appreciated.
I'll restructure the code.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite error: database is locked

2010-03-17 Thread imin imup
> According to documents, sqlite_busy will happen if new reader cannot get

> > shared_lock or new writer cannot get reserved_lock.
> > I didn't see sqlite_busy error from my application.
>
> I didn't understand this. "database is locked" is SQLITE_BUSY.
>
Thanks for clarification. I assumed the error message of error code
SQLITE_BUSY is something like "databased is busy".

>
> > Does this mean I need to close the current database connection before I
> can
> > make the next connection to same database file even through they are not
> > shared?
>
> No, you can have several connections in one thread if you want.
>
> > Though it is not shared, it seems there may be cases where more
> > than 1 database connections are held (in nested function calls). Will
> this
> > cause any issue?
>
> This can definitely be the issue. Consider this scenario:
> - open connection 1;
> - start executing some query on connection 1 - call sqlite3_step() but
> it didn't return SQLITE_DONE yet;
> - open connection 2;
> - execute some update/insert/delete on connection 2
>
> In this case you have active statement on connection 1 that holds
> SHARED lock on the database. And it will prevent any other connections
> from writing. So connection 2 cannot obtain EXCLUSIVE lock, you get
> SQLITE_BUSY without any chances to succeed.
>

Very good point. It seems one connection per function can be error prone.
One long-lived connection per thread might be better.

Another newbie question. Is it safe for 2 threads to share 1 connection when
the connection is protected by my own mutex?

Thanks a lot.


>
> Pavel
>
> On Wed, Mar 17, 2010 at 1:35 PM, imin imup  wrote:
> > Thanks for help. As a novel sqlite user, it seems I need more.
> >
> > According to documents, sqlite_busy will happen if new reader cannot get
> > shared_lock or new writer cannot get reserved_lock.
> > I didn't see sqlite_busy error from my application.
> >
> > My usage is that:
> > single process, multi-thread, multi-database files
> >
> > multi-database files
> > I divided the tables into 2 database files to "increase" concurrency. A
> > thread may open two database file at same time, but two database never
> > appear in one sql statement. Is this likely to cause any issue?
> >
> > about "one connection per thread"
> > Does this mean I need to close the current database connection before I
> can
> > make the next connection to same database file even through they are not
> > shared?
> > I tend to use short-lived database connections locally defined within
> each
> > function. Though it is not shared, it seems there may be cases where more
> > than 1 database connections are held (in nested function calls). Will
> this
> > cause any issue?
> >
> > On Wed, Mar 17, 2010 at 11:05 AM, Pavel Ivanov 
> wrote:
> >
> >> http://www.sqlite.org/faq.html#q5
> >> http://www.sqlite.org/lockingv3.html
> >>
> >> Pavel
> >>
> >> On Wed, Mar 17, 2010 at 11:46 AM, imin imup  wrote:
> >> > Hello users,
> >> >
> >> > I'm using sqlite 3.6.12 in muti-threaded application. I'm getting
> sqlite
> >> > errors occasionally.
> >> > The error message is
> >> >
> >> > *sqlite error: database is locked*
> >> >
> >> > could someone explain to me what happened and what to be done? or
> point
> >> me
> >> > to a document on how to fix this?
> >> >
> >> > Best
> >> >
> >> > Imin
> >> > ___
> >> > 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
> >
> ___
> 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] sqlite error: database is locked

2010-03-17 Thread imin imup
Thanks for help. As a novel sqlite user, it seems I need more.

According to documents, sqlite_busy will happen if new reader cannot get
shared_lock or new writer cannot get reserved_lock.
I didn't see sqlite_busy error from my application.

My usage is that:
single process, multi-thread, multi-database files

multi-database files
I divided the tables into 2 database files to "increase" concurrency. A
thread may open two database file at same time, but two database never
appear in one sql statement. Is this likely to cause any issue?

about "one connection per thread"
Does this mean I need to close the current database connection before I can
make the next connection to same database file even through they are not
shared?
I tend to use short-lived database connections locally defined within each
function. Though it is not shared, it seems there may be cases where more
than 1 database connections are held (in nested function calls). Will this
cause any issue?

On Wed, Mar 17, 2010 at 11:05 AM, Pavel Ivanov  wrote:

> http://www.sqlite.org/faq.html#q5
> http://www.sqlite.org/lockingv3.html
>
> Pavel
>
> On Wed, Mar 17, 2010 at 11:46 AM, imin imup  wrote:
> > Hello users,
> >
> > I'm using sqlite 3.6.12 in muti-threaded application. I'm getting sqlite
> > errors occasionally.
> > The error message is
> >
> > *sqlite error: database is locked*
> >
> > could someone explain to me what happened and what to be done? or point
> me
> > to a document on how to fix this?
> >
> > Best
> >
> > Imin
> > ___
> > 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


[sqlite] sqlite error: database is locked

2010-03-17 Thread imin imup
Hello users,

I'm using sqlite 3.6.12 in muti-threaded application. I'm getting sqlite
errors occasionally.
The error message is

*sqlite error: database is locked*

could someone explain to me what happened and what to be done? or point me
to a document on how to fix this?

Best

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