[Straw] Re: Database conversion failure.



On  4 apr 2006, gs234 srcf ucam org wrote:

> (This has been reported to the Debian bugtracking system:
> <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=359105>.)
>
> Upgrading to 0.26 fails for me.  The issue is an exception on startup:
>
> Traceback (most recent call last):
> File "/usr/lib/straw/straw/ItemStore.py", line 92, in __init__
> self.convert_old_versions()
> File "/usr/lib/straw/straw/ItemStore.py", line 413, in convert_old_versions
> method()
> File "/usr/lib/straw/straw/ItemStore.py", line 500, in convert_2_3
> imagelistcursor.close()
> AttributeError: 'NoneType' object has no attribute 'close'
>
> Now, I'm not familiar with this database stuff so there is no
> guarantee that I'm analysing this correctly, but as nearly as I can
> tell there is no guarantee that imagelistcursor will ever be assigned
> to after the initial assignment to None.  It would then be appropriate
> to protect the call to the close method with an if statement.
>
> Could someone who is familiar with the code verify my analysis?
>
> However, this change alone is not sufficient to allow a successful
> upgrade.  With it, I get this problem:
>
> Traceback (most recent call last):
> File "/usr/lib/straw/straw/ItemStore.py", line 92, in __init__
> self.convert_old_versions()
> File "/usr/lib/straw/straw/ItemStore.py", line 413, in convert_old_versions
> method()
> File "/usr/lib/straw/straw/ItemStore.py", line 487, in convert_2_3
> next = cur.next()
> MemoryError: (12, 'Cannot allocate memory -- Lock table is out of available object entries')
>
> This looks like some sort of db resource problem, but I have no idea
> how to fix it.

It turns out that this can be overcome quite easily by bumping the
limits in a strategic place:

--- /usr/lib/straw/straw/ItemStore.py	2006-02-18 16:22:44.000000000 +0000
+++ straw-0.26/src/lib/ItemStore.py	2006-04-04 21:19:25.000000000 +0100
@@ -60,6 +60,8 @@
         self._env.set_data_dir(dbhome)
         self._env.set_lk_detect(DB_LOCK_DEFAULT)  # enable auto deadlock avoidance
         self._env.set_lg_max(2**20)
+	self._env.set_lk_max_locks   (10000)
+	self._env.set_lk_max_objects (10000)
 
         try:
             self._env.open(dbhome, recoverenv | flagsforenv, mode)
@@ -497,7 +499,8 @@
                 imagelistcursor.put("images", pickle.dumps(images.keys()), DB_CURRENT)
             finally:
                 cur.close()
-                imagelistcursor.close()
+		if imagelistcursor != None:
+		    imagelistcursor.close()
         except Exception, ex:
             txn.abort()
             raise

With this patch I seem to be able to upgrade to 0.26 without problems.
(The patch is only needed for the upgrade; after that vanilla straw
seems to do fine.)

-- 
Gaute Strokkenes
Everybody gets free BORSCHT!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]