views:

75

answers:

2

I am running apache with mod mono and my asp.net app is using mono sqlite as its db. When i refresh the page twice i get the DB is locked error. The folder it is in is chmod 777. The webapp is creating sqlite.db and sqlite.db-journal but it doesnt seem to be able to delete the journal. Also it has problems when i load the page once. It definitely seems to be a permission problem.

i'm confused. What permissions do i need to set these? i tried precreating the files using 777 and had no luck.

-edit- I didnt find a solution however i thought how silly i was being since i was planning to use mysql for my webapp. So i just ported the code and i no longer had issues.

A: 

Sounds more like one instance of the session in apache is blocking the other session, i.e. has the db file open exclusively. Try to let the database(model) run as a singleton (or similar) which all sessions access.

Femaref
This problem doesnt occur on windows. Also it looks like the main db (not the journal) is not being written to at all (when i precreated the file and chmod 777 the file was 0 bytes after refreshing the page and nothing had a lock since i just made it)
acidzombie24
+4  A: 

When creating/deleting a file the directory permission matter.

So, if you really want that, you have to set the containing directory's permissions to 777.

Sample:

$ ls -la
total 21
dr-xr-xr-x  2 me me  1024 May 22 19:19 .          #no write permissions to directory
drwxrwxrwt 21 root   root   19456 May 22 19:19 ..
-rwxrwxrwx  1 me me     0 May 22 19:19 abc        #all permissions to file abc
$ rm abc
rm: cannot remove `abc': Permission denied        #abc has 777, but deleting doesn't work
$ chmod 777 .                                     #change directoy's permissions
$ rm abc                                          #now removing works
$ ls                                              #file abc is gone

The reason is that when you delete a file, you actually modify the directory and not the file itself.

Think of a hard link: The file itself will not change when you delete one hardlink to it, but the directory changes.

Johannes Weiß
ok that is fine but as i said the folder it is in is also 777. So i am confused.
acidzombie24