Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jun 2009 02:07:36 +0900
From:      Hiroto Kagotani <hiroto.kagotani@gmail.com>
To:        Andriy Gapon <avg@icyb.net.ua>
Cc:        FreeBSD Ports <freebsd-ports@freebsd.org>
Subject:   Re: portupgrade/ruby issue? (Stale lock file was found. Removed.)
Message-ID:  <ca15a72c0906171007j623d3bes548263aad8f409d3@mail.gmail.com>
In-Reply-To: <4A38B47E.1070906@icyb.net.ua>
References:  <4A38B47E.1070906@icyb.net.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
2009/6/17 Andriy Gapon <avg@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@gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ca15a72c0906171007j623d3bes548263aad8f409d3>