I am 100% sure that my all my queries go trought that class.
Unfortunatelly it is too late to make such changes ('forces the user
to specify whether the transaction is write or read') - i have too
many scripts to change. About NFS i asked the hosting and they said
they dont use NFS. Do you or someone else know if the PHP extension
for sqlite in PHP 5.0.2 under linux is compiled as threadsafe? because
i read on the sqlite site that the sqlite binaries for linux (not the
extension) are not compiled as threadsafe and to be such they need to
be recompiled with threadsafe swicth and i downloaded the extension
code and saw in the config.m4 (i suppose it's the make file - i don't
know much about linux...) that "define threadsafe 1" is commented...
And can the lack of threadsafe lead to such behaviour? (i suppose it can...)
I have written to one of the authors of the extension and i am
currently waiting for an answer but it wouldn't hurt to know faster...
After all this i suppose you guessed that my problem is still there :(
and unfortunatelly it got worse now it locks not only during the night
but during the day too.
I must say also that the database seems to get locked during a select
query because i can read normally from the database but can't write in
it. Unfortunatelly i need to write because the site is also an eshop
and i need to write down the orders...
I suppose you read that i don't have access to lsof or fuser on the
hosting machine and i can't reproduce the problem locally because i
can't get the database to lock (exept when the script times out and i
only noticed that on a linux machine and i can't confirm that it also
applies to the server - probably will test that tommorow but even if
it applies i have put one hour timeout and my scripts are not that
heavy i have 2 places if i recall correctly where i use recursion and
for the first i am 100% sure it is ok and the second has been used for
-4-5 months without problems and i haven't changed anything on it)
Can a query get the database locked? because i can't imagine a query
that can do that...
And what can lock a database? I tried not to commit a transaction but
the database didn't lock... any ideas? it would be easier if i know
for what to look.
I think i said all.
Thank you I really appreciate your help please give me some more proposals.



On Mon, 29 Nov 2004 14:38:48 -0700 (MST), Ara.T.Howard
<[EMAIL PROTECTED]> wrote:
> On Wed, 24 Nov 2004, Alexander Jordanov wrote:
> 
> 
> 
> > @Ara.T.Howard:
> > Thanks for the suggestion i will try it and hope the database will not
> > lock again...
> > Here is what i did:
> >                clearstatcache ();
> >               if ($sql[0]=='S'){
> >                       $fp=fopen('koral.db.lock','a+');
> >                       while (!flock($fp,LOCK_SH)){};
> >               } else {
> >                       $fp=fopen('koral.db.lock','a+');
> >                       while (!flock($fp,LOCK_EX)){};
> >               }
> >               $result = sqlite_query($this->handle, $sql);
> >               flock($fp,LOCK_UN);
> >               fclose($fp);
> > Please tell me if that is what you meant. My database file is
> > koral.db. This is a part of a class file i use to run the queries
> > $this->handle is the handle returned by
> > sqlite_open('koral.db',0666,$sqliteerror). koral.db.lock is empty i
> > don't write or read from it just check if it's locked or not and
> > according to that determine what i can do. $sql is the query that will
> > run and i check if it's first letter is S from SELECT and if it is i
> > do a shared lock if not Exclusive lock.
> > Thank you for the help.
> 
> yes - sounds resonable if 100% of your access is through this class.  my code
> is very similar.  my class forces the user to specify whether the transaction
> is write or read and issued the appropriate sql and aquires the corresponding
> lock (LOCK_SH, LOCK_EX).  in this way i don't need to check for 'S' etc. which
> is a bit fragile.  in any case you've got the idea.  btw. flock is not safe on
> nfs filesystems.
> 
> sorry i was out when you replied and hope your problem is fixed..
> 
> regards.
> 
> 
> 
> -a
> --
> ===============================================================================
> | EMAIL   :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
> | PHONE   :: 303.497.6469
> | When you do something, you should burn yourself completely, like a good
> | bonfire, leaving no trace of yourself.  --Shunryu Suzuki
> ===============================================================================
>

Reply via email to