Quantcast

Database is Locked

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Database is Locked

Shahar Weinstein
Hi,

I'm using System.Data.Sqlite the latest version that supports .NET 4
in an ordinary .NET website.
when trying to issue a single update to the database I'm receiving the
error message saying that the database file is locked.
there is only one connection open. In the connection string connection
pooling has been set to off
the website is being hosted on a shared hosting server.

usualy there is no problem and , in the development enviroment I couldn't
recreate the problem

please help, if I won't manage to find a solution I would have to switch to
MsAccess database in thie project,
and maybe in future projects too, If I won't find the solution for this
issue.


thanks in advanced
Shahar Weinstein.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Jan Hudec
On Sat, Jan 28, 2012 at 23:36:36 +0200, Shahar Weinstein wrote:
> I'm using System.Data.Sqlite the latest version that supports .NET 4
> in an ordinary .NET website.
> when trying to issue a single update to the database I'm receiving the
> error message saying that the database file is locked.
> there is only one connection open. In the connection string connection
> pooling has been set to off
> the website is being hosted on a shared hosting server.

Sqlite needs wrtie access to the database file itself, ability to create and
write to a file in the same directory as the database file and ability to
create and write to a file in temporary directory.

So first check permissions whether it can do all those operations. To select
temporary directory, set TMP variable in environment before opening the
database. And make sure you set the same temporary directory in all processes
that will access the same database.

--
                                                 Jan 'Bulb' Hudec <[hidden email]>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Shahar Weinstein
hi,

thanks for your reply.
I know there is no permissions problems since after some time when I try
the same action,
it succeeds. in the website, I manage to read/write/delete in different
locations of the code.
and since the website is on a shared hosting I cannot modify the TMP
definitions, which I assume they exist.
the fact that it does work for time to time , makes it difficult to debug.


Shahar.


2012/1/29 Jan Hudec <[hidden email]>

> On Sat, Jan 28, 2012 at 23:36:36 +0200, Shahar Weinstein wrote:
> > I'm using System.Data.Sqlite the latest version that supports .NET 4
> > in an ordinary .NET website.
> > when trying to issue a single update to the database I'm receiving the
> > error message saying that the database file is locked.
> > there is only one connection open. In the connection string connection
> > pooling has been set to off
> > the website is being hosted on a shared hosting server.
>
> Sqlite needs wrtie access to the database file itself, ability to create
> and
> write to a file in the same directory as the database file and ability to
> create and write to a file in temporary directory.
>
> So first check permissions whether it can do all those operations. To
> select
> temporary directory, set TMP variable in environment before opening the
> database. And make sure you set the same temporary directory in all
> processes
> that will access the same database.
>
> --
>                                                 Jan 'Bulb' Hudec <
> [hidden email]>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Jan Hudec
On Sun, Jan 29, 2012 at 00:43:07 +0200, Shahar Weinstein wrote:
> I know there is no permissions problems since after some time when I try
> the same action, it succeeds. in the website, I manage to read/write/delete
> in different locations of the code.

Can it be that the database is really locked by another request running in
parallel? Sqlite only allows one writer to the whole file and unless you set
WAL mode, no readers while writing.

> and since the website is on a shared hosting I cannot modify the TMP

Yes, you can. You should be setting them *inside* the application. At C level
it's setenv() call, but I don't remember the exact .NET equivalent.

> definitions, which I assume they exist.

They are almost certainly wrong on Windows, which it probably is.

--
                                                 Jan 'Bulb' Hudec <[hidden email]>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Simon Slavin-3

On 28 Jan 2012, at 11:47pm, Jan Hudec wrote:

> On Sun, Jan 29, 2012 at 00:43:07 +0200, Shahar Weinstein wrote:
>> I know there is no permissions problems since after some time when I try
>> the same action, it succeeds. in the website, I manage to read/write/delete
>> in different locations of the code.
>
> Can it be that the database is really locked by another request running in
> parallel? Sqlite only allows one writer to the whole file and unless you set
> WAL mode, no readers while writing.

If I get the setup correctly, this is a web-facing app.  Some web servers start a process for each HTTP session, or for each item they serve.  That means that even though he has only one application that accesses the database (an active web page) he might have two concurrent processes using the SQLite API to access the database.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Shahar Weinstein
I don't think that the TMP folder is the right direction but I'll check it
anyway with the hosting company.
besides that, I do know that there is only one process running that tries
to write to the database what makes my situation a sad joke. sqlite
supposed to be a strong database that knows how to deal such simple
situations.
even of 2 processes that tries to write to the database the same time, else
it's probably a very weak database system that doesn't have transactions
locks mechanism inside.

does anyone knows if sqlite got any connection string definitions that
deals with locks? or any other setting that influence the enviroment?


Shahar.


2012/1/29 Simon Slavin <[hidden email]>

>
> On 28 Jan 2012, at 11:47pm, Jan Hudec wrote:
>
> > On Sun, Jan 29, 2012 at 00:43:07 +0200, Shahar Weinstein wrote:
> >> I know there is no permissions problems since after some time when I try
> >> the same action, it succeeds. in the website, I manage to
> read/write/delete
> >> in different locations of the code.
> >
> > Can it be that the database is really locked by another request running
> in
> > parallel? Sqlite only allows one writer to the whole file and unless you
> set
> > WAL mode, no readers while writing.
>
> If I get the setup correctly, this is a web-facing app.  Some web servers
> start a process for each HTTP session, or for each item they serve.  That
> means that even though he has only one application that accesses the
> database (an active web page) he might have two concurrent processes using
> the SQLite API to access the database.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Jan Hudec
On Sun, Jan 29, 2012 at 12:57:21 +0200, Shahar Weinstein wrote:
> I don't think that the TMP folder is the right direction but I'll check it
> anyway with the hosting company.

No, *NOT* *HOSTING* *COMPANY*. Your code.

I agree it's probably not the right direction though.

> besides that, I do know that there is only one process running that tries
> to write to the database what makes my situation a sad joke. sqlite
> supposed to be a strong database that knows how to deal such simple
> situations.

So you are saying, that there is absolutely no other client using the code at
the same time or even that the same client isn't using two windows? Because
otherwise any serious web server will run mutliple instances of your code in
either multiple threads or multiple processes.

> even of 2 processes that tries to write to the database the same time, else
> it's probably a very weak database system that doesn't have transactions
> locks mechanism inside.

It DOES. But very coarse-grained and is telling you the one process has it
locked, so the other process can't access it.

Sqlite is designed to be lightweight. The cost for this is, that it does not
have per-row or per-table locks. A write transactions always needs to lock
the whole database. Additionally by default when the database is locked, the
operation immediately fails with the "database is locked" error you are
seeing.

You need to do three things:

 - Run 'PRAGMA journal=wal' on the database once (see
   http://www.sqlite.org/wal.html). This requires sqlite at least 3.7.0.
 - Set the timeout, so the operations wait for the other process to finish
   for some time instead of failing. The C-level API is sqlite3_busy_timeout
   (http://www.sqlite.org/c3ref/busy_timeout.html). The .NET api will be
   called similar.
 - Plan eventual migration to SQL Server or MySQL or something, because
   sqlite will not scale. It's designed to be fast for data processing and
   small so it can be embedded in desktop or even mobile applications, but
   that means it does not support multiple servers and parallel transactions.
   It can work fine in web app that gets at most few hits a minute, but for
   higher load you will definitiely need a database server.

--
                                                 Jan 'Bulb' Hudec <[hidden email]>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Shahar Weinstein
thanks for your reply.
since my situation IS one process that tries to write to the database, I'm
trying to use the forums help.
if the situation was multiple processes as you described I would move to
mysql or MSaccess database which is quite stable for web applications.
I've programmed few web projects with the sqlite database which never had
this problem.
and those projects are running well, that's why I think I've got a special
situation.

it seems I will, have to move to another database.

thanks
Shahar.



2012/1/29 Jan Hudec <[hidden email]>

> On Sun, Jan 29, 2012 at 12:57:21 +0200, Shahar Weinstein wrote:
> > I don't think that the TMP folder is the right direction but I'll check
> it
> > anyway with the hosting company.
>
> No, *NOT* *HOSTING* *COMPANY*. Your code.
>
> I agree it's probably not the right direction though.
>
> > besides that, I do know that there is only one process running that tries
> > to write to the database what makes my situation a sad joke. sqlite
> > supposed to be a strong database that knows how to deal such simple
> > situations.
>
> So you are saying, that there is absolutely no other client using the code
> at
> the same time or even that the same client isn't using two windows? Because
> otherwise any serious web server will run mutliple instances of your code
> in
> either multiple threads or multiple processes.
>
> > even of 2 processes that tries to write to the database the same time,
> else
> > it's probably a very weak database system that doesn't have transactions
> > locks mechanism inside.
>
> It DOES. But very coarse-grained and is telling you the one process has it
> locked, so the other process can't access it.
>
> Sqlite is designed to be lightweight. The cost for this is, that it does
> not
> have per-row or per-table locks. A write transactions always needs to lock
> the whole database. Additionally by default when the database is locked,
> the
> operation immediately fails with the "database is locked" error you are
> seeing.
>
> You need to do three things:
>
>  - Run 'PRAGMA journal=wal' on the database once (see
>   http://www.sqlite.org/wal.html). This requires sqlite at least 3.7.0.
>  - Set the timeout, so the operations wait for the other process to finish
>   for some time instead of failing. The C-level API is sqlite3_busy_timeout
>   (http://www.sqlite.org/c3ref/busy_timeout.html). The .NET api will be
>   called similar.
>  - Plan eventual migration to SQL Server or MySQL or something, because
>   sqlite will not scale. It's designed to be fast for data processing and
>   small so it can be embedded in desktop or even mobile applications, but
>   that means it does not support multiple servers and parallel
> transactions.
>   It can work fine in web app that gets at most few hits a minute, but for
>   higher load you will definitiely need a database server.
>
> --
>                                                 Jan 'Bulb' Hudec <
> [hidden email]>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Stephen Chrzanowski
Is the hosting company running linux or windows?  You say .net so that
indicates to me windows, but I've been wrong before. (Wife lets me know
frequently. {smirk})

This still "smells" like a permission issue to me.  I acknowledge that
you're able to read/write/modify the web files then upload them, but the
user who is serving the pages to the web clients may not have WRITE
permissions to the directory where the web pages are hosted.  I don't
know exactly how you upload your pages to your site, but via FTP, or
Samba, a specialized web interface, or whatever, you're typically
provided with a username and password to log in.  However, the "user"
that actually reads and writes to that directory that hosts the data to
the web CLIENTS is typically the web service.  Can't think of the user
for windows (iisadmin?  iisuser? Something like that anyways), but for
linux it is usually either the user "httpd" or "apache2".  If the users
"httpd" or "apache2" don't have WRITE access to that directory, you
could have problems.  The SQLite engine may need to create a temporary
file.  If the temp file can't be written, it may throw an exception
which is why you're getting the error.

Depending on your site provider, you may have a "public" directory where
all your web pages live, then a "private" directory where other stuff
sits, like databases.  The PUBLIC directory may be locked down by
default so that nothing via the web interface can modify files,
including writing to your SQLite database, and a private place that
anyone can write to.  Try moving your database into a private directory,
set your application to open the directory from there, and see what happens.

SQLite doesn't have any problem hosting a database for web applications
for light to medium use, according to documentation.  Which means you're
not going to run a Google-ish size of site, nor even EBay, but, it
should be able to handle something like forums, wikis, and so on.  If
you're going to start using MS-Access for your database back end, I
*KNOW* you're not going to towards a Google-ish size of site.

On 01/29/2012 06:54 AM, Shahar Weinstein wrote:

> thanks for your reply.
> since my situation IS one process that tries to write to the database, I'm
> trying to use the forums help.
> if the situation was multiple processes as you described I would move to
> mysql or MSaccess database which is quite stable for web applications.
> I've programmed few web projects with the sqlite database which never had
> this problem.
> and those projects are running well, that's why I think I've got a special
> situation.
>
> it seems I will, have to move to another database.
>
> thanks
> Shahar.
>
>
>
> 2012/1/29 Jan Hudec<[hidden email]>
>
>> On Sun, Jan 29, 2012 at 12:57:21 +0200, Shahar Weinstein wrote:
>>> I don't think that the TMP folder is the right direction but I'll check
>> it
>>> anyway with the hosting company.
>> No, *NOT* *HOSTING* *COMPANY*. Your code.
>>
>> I agree it's probably not the right direction though.
>>
>>> besides that, I do know that there is only one process running that tries
>>> to write to the database what makes my situation a sad joke. sqlite
>>> supposed to be a strong database that knows how to deal such simple
>>> situations.
>> So you are saying, that there is absolutely no other client using the code
>> at
>> the same time or even that the same client isn't using two windows? Because
>> otherwise any serious web server will run mutliple instances of your code
>> in
>> either multiple threads or multiple processes.
>>
>>> even of 2 processes that tries to write to the database the same time,
>> else
>>> it's probably a very weak database system that doesn't have transactions
>>> locks mechanism inside.
>> It DOES. But very coarse-grained and is telling you the one process has it
>> locked, so the other process can't access it.
>>
>> Sqlite is designed to be lightweight. The cost for this is, that it does
>> not
>> have per-row or per-table locks. A write transactions always needs to lock
>> the whole database. Additionally by default when the database is locked,
>> the
>> operation immediately fails with the "database is locked" error you are
>> seeing.
>>
>> You need to do three things:
>>
>>   - Run 'PRAGMA journal=wal' on the database once (see
>>    http://www.sqlite.org/wal.html). This requires sqlite at least 3.7.0.
>>   - Set the timeout, so the operations wait for the other process to finish
>>    for some time instead of failing. The C-level API is sqlite3_busy_timeout
>>    (http://www.sqlite.org/c3ref/busy_timeout.html). The .NET api will be
>>    called similar.
>>   - Plan eventual migration to SQL Server or MySQL or something, because
>>    sqlite will not scale. It's designed to be fast for data processing and
>>    small so it can be embedded in desktop or even mobile applications, but
>>    that means it does not support multiple servers and parallel
>> transactions.
>>    It can work fine in web app that gets at most few hits a minute, but for
>>    higher load you will definitiely need a database server.
>>
>> --
>>                                                  Jan 'Bulb' Hudec<
>> [hidden email]>
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email]
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Shahar Weinstein
thanks for the reply but its not a permission issue, since after few hours
the problem dissapears
and there is no problem to save data into the database.
the problem comes, stays for few hours and than disappears.
it's very strange since on my development machine it does not happen.

Shahar.




2012/1/29 Stephen C <[hidden email]>

> Is the hosting company running linux or windows?  You say .net so that
> indicates to me windows, but I've been wrong before. (Wife lets me know
> frequently. {smirk})
>
> This still "smells" like a permission issue to me.  I acknowledge that
> you're able to read/write/modify the web files then upload them, but the
> user who is serving the pages to the web clients may not have WRITE
> permissions to the directory where the web pages are hosted.  I don't know
> exactly how you upload your pages to your site, but via FTP, or Samba, a
> specialized web interface, or whatever, you're typically provided with a
> username and password to log in.  However, the "user" that actually reads
> and writes to that directory that hosts the data to the web CLIENTS is
> typically the web service.  Can't think of the user for windows (iisadmin?
>  iisuser? Something like that anyways), but for linux it is usually either
> the user "httpd" or "apache2".  If the users "httpd" or "apache2" don't
> have WRITE access to that directory, you could have problems.  The SQLite
> engine may need to create a temporary file.  If the temp file can't be
> written, it may throw an exception which is why you're getting the error.
>
> Depending on your site provider, you may have a "public" directory where
> all your web pages live, then a "private" directory where other stuff sits,
> like databases.  The PUBLIC directory may be locked down by default so that
> nothing via the web interface can modify files, including writing to your
> SQLite database, and a private place that anyone can write to.  Try moving
> your database into a private directory, set your application to open the
> directory from there, and see what happens.
>
> SQLite doesn't have any problem hosting a database for web applications
> for light to medium use, according to documentation.  Which means you're
> not going to run a Google-ish size of site, nor even EBay, but, it should
> be able to handle something like forums, wikis, and so on.  If you're going
> to start using MS-Access for your database back end, I *KNOW* you're not
> going to towards a Google-ish size of site.
>
> On 01/29/2012 06:54 AM, Shahar Weinstein wrote:
>
>> thanks for your reply.
>> since my situation IS one process that tries to write to the database, I'm
>> trying to use the forums help.
>> if the situation was multiple processes as you described I would move to
>> mysql or MSaccess database which is quite stable for web applications.
>> I've programmed few web projects with the sqlite database which never had
>> this problem.
>> and those projects are running well, that's why I think I've got a special
>> situation.
>>
>> it seems I will, have to move to another database.
>>
>> thanks
>> Shahar.
>>
>>
>>
>> 2012/1/29 Jan Hudec<[hidden email]>
>>
>>  On Sun, Jan 29, 2012 at 12:57:21 +0200, Shahar Weinstein wrote:
>>>
>>>> I don't think that the TMP folder is the right direction but I'll check
>>>>
>>> it
>>>
>>>> anyway with the hosting company.
>>>>
>>> No, *NOT* *HOSTING* *COMPANY*. Your code.
>>>
>>> I agree it's probably not the right direction though.
>>>
>>>  besides that, I do know that there is only one process running that
>>>> tries
>>>> to write to the database what makes my situation a sad joke. sqlite
>>>> supposed to be a strong database that knows how to deal such simple
>>>> situations.
>>>>
>>> So you are saying, that there is absolutely no other client using the
>>> code
>>> at
>>> the same time or even that the same client isn't using two windows?
>>> Because
>>> otherwise any serious web server will run mutliple instances of your code
>>> in
>>> either multiple threads or multiple processes.
>>>
>>>  even of 2 processes that tries to write to the database the same time,
>>>>
>>> else
>>>
>>>> it's probably a very weak database system that doesn't have transactions
>>>> locks mechanism inside.
>>>>
>>> It DOES. But very coarse-grained and is telling you the one process has
>>> it
>>> locked, so the other process can't access it.
>>>
>>> Sqlite is designed to be lightweight. The cost for this is, that it does
>>> not
>>> have per-row or per-table locks. A write transactions always needs to
>>> lock
>>> the whole database. Additionally by default when the database is locked,
>>> the
>>> operation immediately fails with the "database is locked" error you are
>>> seeing.
>>>
>>> You need to do three things:
>>>
>>>  - Run 'PRAGMA journal=wal' on the database once (see
>>>   http://www.sqlite.org/wal.html**). This requires sqlite at least
>>> 3.7.0.
>>>  - Set the timeout, so the operations wait for the other process to
>>> finish
>>>   for some time instead of failing. The C-level API is
>>> sqlite3_busy_timeout
>>>   (http://www.sqlite.org/c3ref/**busy_timeout.html<http://www.sqlite.org/c3ref/busy_timeout.html>).
>>> The .NET api will be
>>>   called similar.
>>>  - Plan eventual migration to SQL Server or MySQL or something, because
>>>   sqlite will not scale. It's designed to be fast for data processing and
>>>   small so it can be embedded in desktop or even mobile applications, but
>>>   that means it does not support multiple servers and parallel
>>> transactions.
>>>   It can work fine in web app that gets at most few hits a minute, but
>>> for
>>>   higher load you will definitiely need a database server.
>>>
>>> --
>>>                                                 Jan 'Bulb' Hudec<
>>> [hidden email]>
>>> ______________________________**_________________
>>> sqlite-users mailing list
>>> [hidden email]
>>> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users>
>>>
>>>  ______________________________**_________________
>> sqlite-users mailing list
>> [hidden email]
>> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users>
>>
>
> ______________________________**_________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users>
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Black, Michael (IS)
Do you have shell access I hope?



Check out "fuser" and see if you can find a process attached to it.



Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems

________________________________
From: [hidden email] [[hidden email]] on behalf of Shahar Weinstein [[hidden email]]
Sent: Sunday, January 29, 2012 8:40 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Database is Locked

thanks for the reply but its not a permission issue, since after few hours
the problem dissapears
and there is no problem to save data into the database.
the problem comes, stays for few hours and than disappears.
it's very strange since on my development machine it does not happen.

Shahar.


_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Shahar Weinstein
thanks for the reply.

but, I'm using a shared hosting running Windows. so, no shell no fuser.

Shahar.


2012/1/29 Black, Michael (IS) <[hidden email]>

> Do you have shell access I hope?
>
>
>
> Check out "fuser" and see if you can find a process attached to it.
>
>
>
> Michael D. Black
>
> Senior Scientist
>
> Advanced Analytics Directorate
>
> Advanced GEOINT Solutions Operating Unit
>
> Northrop Grumman Information Systems
>
> ________________________________
> From: [hidden email] [[hidden email]]
> on behalf of Shahar Weinstein [[hidden email]]
> Sent: Sunday, January 29, 2012 8:40 AM
> To: General Discussion of SQLite Database
> Subject: EXT :Re: [sqlite] Database is Locked
>
> thanks for the reply but its not a permission issue, since after few hours
> the problem dissapears
> and there is no problem to save data into the database.
> the problem comes, stays for few hours and than disappears.
> it's very strange since on my development machine it does not happen.
>
> Shahar.
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Black, Michael (IS)
Try this then:

http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems

________________________________
From: [hidden email] [[hidden email]] on behalf of Shahar Weinstein [[hidden email]]
Sent: Sunday, January 29, 2012 9:03 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Database is Locked

thanks for the reply.

but, I'm using a shared hosting running Windows. so, no shell no fuser.

Shahar.


2012/1/29 Black, Michael (IS) <[hidden email]>

> Do you have shell access I hope?
>
>
>
> Check out "fuser" and see if you can find a process attached to it.
>
>
>
> Michael D. Black
>
> Senior Scientist
>
> Advanced Analytics Directorate
>
> Advanced GEOINT Solutions Operating Unit
>
> Northrop Grumman Information Systems
>
> ________________________________
> From: [hidden email] [[hidden email]]
> on behalf of Shahar Weinstein [[hidden email]]
> Sent: Sunday, January 29, 2012 8:40 AM
> To: General Discussion of SQLite Database
> Subject: EXT :Re: [sqlite] Database is Locked
>
> thanks for the reply but its not a permission issue, since after few hours
> the problem dissapears
> and there is no problem to save data into the database.
> the problem comes, stays for few hours and than disappears.
> it's very strange since on my development machine it does not happen.
>
> Shahar.
>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Shahar Weinstein
hi,

thanks for your intention. but it's a shared hosting. I do not have a
remote desktop access that allows me
to run any application I desire. and besides that there is no need to
monitor processes.
the situation is quite simple, the sqlite database I'm using is failing to
serve one update from one process.
and this problem comes and goes, and when it comes, it stays for some time.

there is no connection string settings that I'm familiar with so I see this
problem with no solution.

Shahar.

2012/1/29 Black, Michael (IS) <[hidden email]>

> Try this then:
>
> http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
>
>
>
>
>
> Michael D. Black
>
> Senior Scientist
>
> Advanced Analytics Directorate
>
> Advanced GEOINT Solutions Operating Unit
>
> Northrop Grumman Information Systems
>
> ________________________________
> From: [hidden email] [[hidden email]]
> on behalf of Shahar Weinstein [[hidden email]]
> Sent: Sunday, January 29, 2012 9:03 AM
> To: General Discussion of SQLite Database
> Subject: EXT :Re: [sqlite] Database is Locked
>
> thanks for the reply.
>
> but, I'm using a shared hosting running Windows. so, no shell no fuser.
>
> Shahar.
>
>
> 2012/1/29 Black, Michael (IS) <[hidden email]>
>
> > Do you have shell access I hope?
> >
> >
> >
> > Check out "fuser" and see if you can find a process attached to it.
> >
> >
> >
> > Michael D. Black
> >
> > Senior Scientist
> >
> > Advanced Analytics Directorate
> >
> > Advanced GEOINT Solutions Operating Unit
> >
> > Northrop Grumman Information Systems
> >
> > ________________________________
> > From: [hidden email] [[hidden email]]
> > on behalf of Shahar Weinstein [[hidden email]]
> > Sent: Sunday, January 29, 2012 8:40 AM
> > To: General Discussion of SQLite Database
> > Subject: EXT :Re: [sqlite] Database is Locked
> >
> > thanks for the reply but its not a permission issue, since after few
> hours
> > the problem dissapears
> > and there is no problem to save data into the database.
> > the problem comes, stays for few hours and than disappears.
> > it's very strange since on my development machine it does not happen.
> >
> > Shahar.
> >
> >
> > _______________________________________________
> > sqlite-users mailing list
> > [hidden email]
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Simon Slavin-3

On 29 Jan 2012, at 3:11pm, Shahar Weinstein wrote:

> the sqlite database I'm using is failing to
> serve one update from one process.
> and this problem comes and goes, and when it comes, it stays for some time.

Is this for a web-facing service ?  In other words, someone looks up a page on a web site and the web server needs access to the database to decide what to put on the page ?

If so, you need to be aware that the web server can create multiple processes to do its job.  In other words, you may have written only one application, but the web server may make one process to answer each web request.  So you can still end up with multiple processes even if you didn't write more than one app.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Shahar Weinstein
no, its an ordinary website.
the situation is simple. I'm trying to save into the database some data
taken from a web form with one simple,
update query. the database is being opened and then immidietly being closed.

as I mentioned before. the problem appears. and than stays for
seconds,minutes or an hour, and than disappears again.

is there a way to influence the sqlite engine to produce a log file in
order to understand the situation better?

Shahar.



2012/1/29 Simon Slavin <[hidden email]>

>
> On 29 Jan 2012, at 3:11pm, Shahar Weinstein wrote:
>
> > the sqlite database I'm using is failing to
> > serve one update from one process.
> > and this problem comes and goes, and when it comes, it stays for some
> time.
>
> Is this for a web-facing service ?  In other words, someone looks up a
> page on a web site and the web server needs access to the database to
> decide what to put on the page ?
>
> If so, you need to be aware that the web server can create multiple
> processes to do its job.  In other words, you may have written only one
> application, but the web server may make one process to answer each web
> request.  So you can still end up with multiple processes even if you
> didn't write more than one app.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Simon Slavin-3

On 29 Jan 2012, at 4:14pm, Shahar Weinstein wrote:

> no, its an ordinary website.
> the situation is simple. I'm trying to save into the database some data
> taken from a web form with one simple,
> update query. the database is being opened and then immidietly being closed.

So you do execute sqlite3_close() on it, and you do check the value being returned to make sure it doesn't indicate an error ?

> as I mentioned before. the problem appears. and than stays for
> seconds,minutes or an hour, and than disappears again.

On the computer that the database file is stored on, run an application which shows you what processes have which files open.  On a Mac it's 'lsof'.  On Windows 'openfiles' will show you only files opened by network users.  You need something which shows files opened by local processes too.  Maybe this will do it:

http://www.nirsoft.net/utils/process_activity_view.html

> is there a way to influence the sqlite engine to produce a log file in
> order to understand the situation better?

I bet that the process which has the file open is not your database program, it's a backup app, or a virus-checker, or something like that.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Database is Locked

Kees Nuyt
In reply to this post by Shahar Weinstein
On Sun, 29 Jan 2012 17:11:35 +0200, Shahar Weinstein
<[hidden email]> wrote:

>hi,
>
>thanks for your intention. but it's a shared hosting. I do not have a
>remote desktop access that allows me
>to run any application I desire. and besides that there is no need to
>monitor processes.

Many of the sysinternal tools can sense events on a remote server
without having remote desktop access. A windows account/password
suffices, and of course the management interface (whatever that is) has
to be enabled.

>the situation is quite simple, the sqlite database I'm using is failing to
>serve one update from one process.
>and this problem comes and goes, and when it comes, it stays for some time.

Every sqlite3_*() API call returns an error code when it fails, and
extended error diags can be retrieved after an error. Doesn't that
render something useful?

As Simon already suggested "I bet that the process which has the file
open is not your database program, it's a backup app, or a
virus-checker, or something like that.".

Some of those blocking issues are more likely if certain file extensions
are used. '.db' is famous for unwanted attention of the MS Windows OS,
but it's not the only one.
Try changing the extension to something innocent, like .sqlite or
.sqlite3 or something similar.

If the cause is a virusscanner, you'll have to contact the hoster to add
scan exclusions.

>there is no connection string settings that I'm familiar with so I see this
>problem with no solution.
>
>Shahar.
>
>2012/1/29 Black, Michael (IS) <[hidden email]>
>
>> Try this then:
>>
>> http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
>>
>>
>> Michael D. Black

--
Regards,

Kees Nuyt

_______________________________________________
sqlite-users mailing list
[hidden email]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Loading...