portupgrade/ruby issue? (Stale lock file was found. Removed.)

Hiroto Kagotani hiroto.kagotani at gmail.com
Wed Jun 17 17:28:46 UTC 2009


2009/6/17 Andriy Gapon <avg at icyb.net.ua>:
>
> After recent massive ports update (I think ruby was touch and probably portupgrade
> too) I started getting seemingly sporadic "Stale lock file was found. Removed."
> messages.

It is probably caused by ruby-1.8.7's bug fogetting to call finalizers.
This is filed as Bug #1556 (http://redmine.ruby-lang.org/issues/show/1556
... japanese page; please translate it ;)

Workaround for the case may be using at_exit instead of finalizers.
My sample fix is:

--- pkgdb.rb.orig       2009-04-14 16:56:38.000000000 +0900
+++ pkgdb.rb    2009-06-18 01:49:19.000000000 +0900
@@ -103,8 +103,8 @@
 #    end
   end

-  def PkgDB.finalizer
-    Proc.new {
+  def PkgDB.define_at_exit
+    at_exit {
       PkgDBTools.remove_lock(LOCK_FILE)
     }
   end
@@ -113,7 +113,7 @@
     @db = nil
     @lock_file = Process.euid == 0 ? LOCK_FILE : nil
     @db_version = DB_VERSION
-    ObjectSpace.define_finalizer(self, PkgDB.finalizer)
+    PkgDB.define_at_exit
     setup(*args)
   end

--- portsdb.rb.orig     2009-04-14 16:56:38.000000000 +0900
+++ portsdb.rb  2009-06-18 01:49:04.000000000 +0900
@@ -153,8 +153,8 @@
     end
   end

-  def PortsDB.finalizer
-    Proc.new {
+  def PortsDB.define_at_exit
+    at_exit {
       PkgDBTools.remove_lock(LOCK_FILE)
     }
   end
@@ -163,7 +163,7 @@
     @db = nil
     @lock_file = Process.euid == 0 ? LOCK_FILE : nil
     @db_version = DB_VERSION
-    ObjectSpace.define_finalizer(self, PortsDB.finalizer)
+    PortsDB.define_at_exit
     set_ports_dir(alt_ports_dir)
     set_db_dir(alt_db_dir)
     set_db_driver(alt_db_driver)


-- 
Hiroto Kagotani
<hiroto.kagotani at gmail.com>


More information about the freebsd-ports mailing list