$ emerge --info Traceback (most recent call last): File "/usr/bin/emerge", line 5254, in ? retval = emerge_main() File "/usr/bin/emerge", line 4944, in emerge_main portdb = trees[settings["ROOT"]]["porttree"].dbapi File "/usr/lib/portage/pym/portage_util.py", line 882, in __getitem__ return value_callable(*pargs, **kwargs) File "/usr/lib/portage/pym/portage_util.py", line 866, in __call__ self._value = self._callable(*self._pargs, **self._kwargs) File "/usr/lib/portage/pym/portage.py", line 4457, in __init__ self.dbapi = portdbapi( File "/usr/lib/portage/pym/portage.py", line 5469, in __init__ self.auxdb[x] = self.auxdbmodule( File "/usr/lib/portage/pym/cache/sqlite.py", line 41, in __init__ self._db_init_connection(config) File "/usr/lib/portage/pym/cache/sqlite.py", line 62, in _db_init_connection raise cache_errors.InitializationError(self.__class__, e) cache.cache_errors.InitializationError: Creation of instance <class 'cache.sqlite.database'> failed due to database is locked Would be nice to handle this a bit more gracefully (IIRC this doesn't happen with default metadata cache).
As per our discussion on irc, after removing /var/cache/edb/dep/usr/portage.sqlite and running emerge --metadata, we are unable to reproduce this error (with sqlite-3.3.6 and pysqlite-2.3.1 on x86). I'm not sure what might have triggered that. According to the sqlite docs at http://www.sqlite.org/lockingv3.html, "In order to maximize concurrency, SQLite works to minimize the amount of time that EXCLUSIVE locks are held". For reference, portage's sqlite cache module uses sqlite3's default "autocommit" mode.
After looking at some pysqlite bug reports, I've decided to increase the timeout for 'database is locked' errors from 5 seconds to 15 seconds (in svn r5434). For reference, these are the bugs: http://www.initd.org/tracker/pysqlite/ticket/162 http://www.initd.org/tracker/pysqlite/ticket/126
This has been released in 2.1.2_rc4-r4.