After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 356983 - When starting, get a Fatal Error: database is locked
When starting, get a Fatal Error: database is locked
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: 2.x
Assigned To: Banshee Maintainers
Banshee Maintainers
: 525729 (view as bug list)
Depends on: 520714
Blocks:
 
 
Reported: 2006-09-20 23:09 UTC by Dave Abraham
Modified: 2008-05-28 23:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Strace of banshee startup under a normal user. (749.06 KB, text/plain)
2007-12-22 17:38 UTC, Dan Brown
Details
strace of sqlite3 cli attempt to access banshee.db (7.76 KB, text/plain)
2007-12-22 17:42 UTC, Dan Brown
Details

Description Dave Abraham 2006-09-20 23:09:21 UTC
I start with an kubuntu dapper (6.06) linux distro.  I did a apt-get build-dep banshee to get all the dependencies built.  I then followed the instructions on the banshee-project site for getting the 0.11 cvs build and built it.  Upon first start, I get the start image and then the error dialog.  The following is the trace I get:

An unhandled exception was thrown: database is locked

in <0x00106> Mono.Data.SqliteClient.SqliteCommand:GetNextStatement (IntPtr pzStart, System.IntPtr pzTail, System.IntPtr pStmt)
in <0x000d0> Mono.Data.SqliteClient.SqliteCommand:ExecuteReader (CommandBehavior behavior, Boolean want_results, System.Int32 rows_affected)
in <0x0001c> Mono.Data.SqliteClient.SqliteCommand:ExecuteNonQuery ()
in <0x00072> Banshee.Database.QueuedSqliteCommand:Execute ()
.NET Version: 2.0.50727.42

Assembly Version Information:

System.Data (2.0.0.0)
Mono.Data.SqliteClient (2.0.0.0)
pango-sharp (2.8.0.0)
dbus-sharp (0.60.0.0)
Mono.Posix (2.0.0.0)
Banshee.Widgets (0.11.0.36546)
glade-sharp (2.8.0.0)
gnome-sharp (2.8.0.0)
gconf-sharp (2.8.0.0)
gdk-sharp (2.8.0.0)
System (2.0.0.0)
atk-sharp (2.8.0.0)
glib-sharp (2.8.0.0)
gtk-sharp (2.8.0.0)
Banshee.Base (0.11.0.36548)
banshee (0.11.0.36556)
mscorlib (2.0.0.0)

Platform Information: Linux 2.6.15-23-386 i686 unknown GNU/Linux

Disribution Information:

[/etc/debian_version]
testing/unstable

[/etc/lsb-release]
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=6.06
DISTRIB_CODENAME=dapper
DISTRIB_DESCRIPTION="Ubuntu 6.06 LTS"
Comment 1 Aaron Bockover 2006-09-20 23:18:55 UTC
What version of sqlite?
Comment 2 Dave Abraham 2006-09-20 23:38:39 UTC
# pkg-config --modversion sqlite3
3.2
Comment 3 Josiah Ritchie - flickerfly 2007-01-18 21:11:23 UTC
Are you still experiencing this with the latest banshee?
Comment 4 Dave Abraham 2007-01-18 21:34:29 UTC
Actually, I am.  I just pulled the latest code down about 2 nights ago and am getting exactly the same problem.
Comment 5 Ruben Vermeersch 2007-01-19 10:21:38 UTC
Does this happen every time?

Also, can you open the database with the command line utility sqlite3.

Try the following:

$ sqlite3 ~/.gnome2/banshee/banshee.db
SQLite version 3.3.10
Enter ".help" for instructions
sqlite> select * from tracks limit 1;

This should work, if it doesn't, then we have a good clue where to look.
Comment 6 Dave Abraham 2007-01-20 16:20:39 UTC
This did not work.  I recieved the same "SQL error: database is locked"
Comment 7 Dave Abraham 2007-01-20 16:22:42 UTC
I even attempted to remove the banshee.db file and let it be recreated.  It was recreated, but I got the same error starting banshee.
Comment 8 Michael Monreal 2007-02-07 16:02:47 UTC
I've seen this error a few times now (about 4-5 times in the last 1-2 weeks). But *never* at the startup. I thought it had something to do with fetching podcasts but it just now happened while banshee was playing in the background (and btw it still is playing!):


An unhandled exception was thrown: The database is locked.

  at Mono.Data.SqliteClient.SqliteCommand.ExecuteStatement (IntPtr pStmt, System.Int32& cols, System.IntPtr& pazValue, System.IntPtr& pazColName) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteStatement (IntPtr pStmt) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior behavior, Boolean want_results, System.Int32& rows_affected) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteNonQuery () [0x00000] 
  at Banshee.Database.QueuedSqliteCommand.Execute () [0x00000] 
.NET Version: 2.0.50727.42


This error is presented in a nice "fatal error" box, if I click on close banshee exits.
Comment 9 Mikayla Hutchinson 2007-04-19 01:42:12 UTC
I get this exception every hour or two with Banshee SVN on Ubuntu Feisty when it's trying to increment the play count in the db. It carries on playing, and I can chnage tracks via the notification tray icon, so presumably this isn't as fatal as it makes out.
Comment 10 Dan Brown 2007-12-22 17:38:59 UTC
Created attachment 101465 [details]
Strace of banshee startup under a normal user.
Comment 11 Dan Brown 2007-12-22 17:41:42 UTC
I get this exception as well when starting as a normal user.  If there is no banshee.db file in place one gets created but it is of size zero (0kb).

When started under an X session for root, the program works normally.

I've included a strace of both starting banshee as well as attempting to access a database created by root and copied(and chown'd, etc) into a user account.

The database is not accessible even under root when copied into a user directory.
Here for example is the root banshee.db

midgard:/# cd .config/banshee
midgard:~/.config/banshee# sqlite3 banshee.db
SQLite version 3.5.4
Enter ".help" for instructions
sqlite> .databases
seq  name             file
---  ---------------  ----------------------------------------------------------
0    main             /root/.config/banshee/banshee.db
sqlite>        

And this is using root to access the user DB. (which is the root DB copied to the user directory with changed file permissions)  Root should still be able to access this should I not?

midgard:~/.config/banshee# cd /home/dan/.config/banshee
midgard:/home/dan/.config/banshee# sqlite3 banshee.db
SQLite version 3.5.4
Enter ".help" for instructions
sqlite> .databases
Error: database is locked
sqlite>    

This looks like an sqlite problem to me but I don't know how to fix it.
Also see my sqlite strace and banshee strace to see if they are of any use.

Comment 12 Dan Brown 2007-12-22 17:42:46 UTC
Created attachment 101466 [details]
strace of sqlite3 cli attempt to access banshee.db
Comment 13 Ruben Vermeersch 2007-12-22 22:25:28 UTC
(In reply to comment #11)
> I get this exception as well when starting as a normal user.  If there is no
> banshee.db file in place one gets created but it is of size zero (0kb).

Is your disk full?
Comment 14 Dan Brown 2007-12-23 15:59:13 UTC
No.  The home directory is network shared, but no other programs are having problems writing to my home directory.

My distro is also Debian btw. lenny/sid (which I guess is rougly equivalent to testing/unstable on Ubuntu).
Comment 15 Andrew Conkling 2008-02-16 04:07:18 UTC
Is this still a problem in current trunk? What are the ownership and permissions of banshee.db?
Comment 16 Michael Monreal 2008-02-16 09:04:26 UTC
I have personally never seen it happen in Trunk, but perhaps I'm just still not using it long enough...
Comment 17 Andrew Conkling 2008-03-22 01:50:08 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for.
Thanks!
Comment 18 Andrew Conkling 2008-04-07 00:20:17 UTC
*** Bug 525729 has been marked as a duplicate of this bug. ***
Comment 19 Stephane Delcroix 2008-04-07 08:23:24 UTC
reproductible with today's trunk (Apr 7, 2008).

An unhandled exception was thrown: The database is locked.

  at Mono.Data.SqliteClient.SqliteCommand.ExecuteStatement (IntPtr pStmt, System.Int32& cols, System.IntPtr& pazValue, System.IntPtr& pazColName) [0x00000] 
  at (wrapper remoting-invoke-with-check) Mono.Data.SqliteClient.SqliteCommand:ExecuteStatement (intptr,int&,intptr&,intptr&)
  at Mono.Data.SqliteClient.SqliteDataReader.ReadpVm (IntPtr pVm, Int32 version, Mono.Data.SqliteClient.SqliteCommand cmd) [0x00000] 
  at Mono.Data.SqliteClient.SqliteDataReader..ctor (Mono.Data.SqliteClient.SqliteCommand cmd, IntPtr pVm, Int32 version) [0x00000] 
  at (wrapper remoting-invoke-with-check) Mono.Data.SqliteClient.SqliteDataReader:.ctor (Mono.Data.SqliteClient.SqliteCommand,intptr,int)
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior behavior, Boolean want_results, System.Int32& rows_affected) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior behavior) [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader () [0x00000] 
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteScalar () [0x00000] 
  at Hyena.Data.Sqlite.HyenaSqliteCommand.Execute (Hyena.Data.Sqlite.HyenaSqliteConnection hconnection, Mono.Data.SqliteClient.SqliteConnection connection) [0x0006d] in /home/sde/src/banshee/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/HyenaSqliteCommand.cs:101 
Exception has been thrown by the target of an invocation.

  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 
  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] 
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] 
  at System.Activator.CreateInstance (System.Type type) [0x00000] 
  at Mono.Addins.TypeExtensionNode.CreateInstance () [0x00000] 
  at Mono.Addins.InstanceExtensionNode.CreateInstance (System.Type expectedType) [0x00000] 
  at Banshee.Sources.SourceManager.LoadExtensionSources () [0x00021] in /home/sde/src/banshee/banshee/src/Core/Banshee.Services/Banshee.Sources/SourceManager.cs:68 
  at Banshee.ServiceStack.Application.Run () [0x0004e] in /home/sde/src/banshee/banshee/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs:69 
  at Banshee.Gui.GtkBaseClient.Initialize (Boolean registerCommonServices) [0x000b7] in /home/sde/src/banshee/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:106 
  at Banshee.Gui.GtkBaseClient..ctor (Boolean initializeDefault, System.String defaultIconName) [0x00013] in /home/sde/src/banshee/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:68 
  at Banshee.Gui.GtkBaseClient..ctor () [0x00000] in /home/sde/src/banshee/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:60 
  at Nereid.Client..ctor () [0x00000] 
  at <0x00000> <unknown method>
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 
Exception has been thrown by the target of an invocation.

  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 
  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] 
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] 
  at System.Activator.CreateInstance (System.Type type) [0x00000] 
  at Banshee.Gui.GtkBaseClient.Startup () [0x00000] in /home/sde/src/banshee/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:55 
  at Hyena.Gui.CleanRoomStartup.Startup (Hyena.Gui.StartupInvocationHandler startup) [0x00048] in /home/sde/src/banshee/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CleanRoomStartup.cs:54 

.NET Version: 2.0.50727.42
OS Version: Unix 2.6.22.17

Assembly Version Information:
Comment 20 Ruben Vermeersch 2008-04-07 08:28:30 UTC
When you get that, could you run an lsof to find out if other applications are using the database?
Comment 21 Stephane Delcroix 2008-04-07 08:53:44 UTC
hey ruben, as I said in bug #525729, bug #520714 allow multiple banshee-1 instances. so the other application is banshee-1 itself.

solving 520714 will hide this bug, but I still think the exception had to be caught to avoid subtle bugs in the future...
Comment 22 Aaron Bockover 2008-05-28 23:31:03 UTC
If there are lock issues between banshee instances, that's desirable and the crash is warranted.

The point of single instance is to avoid this, though if you know what you are doing you can run multiple instances safely by passing --disable-dbus and --db=something to a second instance.

I'm closing this since the single instance code is now committed.