Bug 565930

Summary: DBUS hangs while evaluating unsigned patches
Product: [SUSE Appliance Toolkit] WebYaST Reporter: Stefan Schubert <schubi>
Component: Patch/UpdateAssignee: Martin Vidner <mvidner>
Status: RESOLVED FIXED QA Contact: Klaus Kämpf <kkaempf>
Severity: Normal    
Priority: P3 - Medium CC: lslezak
Version: unspecified   
Target Milestone: SLE11 SP1 GMC   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Stefan Schubert 2009-12-18 11:48:39 UTC
In the case of an libzypp/PackageKit errors the DBUS communication hangs and therefore the complete service hangs.
How to reproduce:
Generate a GPG signed request by
- remove a gpg key with rpm (rpm -e rpm -e gpg-pubkey-<id> )
- remove libzypp cache (zypper clean -M)

So zypper would ask to accept the key now.

Call the service with
http://0.0.0.0:3001/patches repeatedly in a short period ( long periods works)
After the third call the service hangs.

Ladislav could you please check ? Thanks.
Comment 1 Stefan Schubert 2009-12-18 12:08:02 UTC
The interesting point is that after adding signal handling for the error:

----------------------------------------------------------------------

diff --git a/plugins/patches/app/models/resolvable.rb b/plugins/patches/app/models/resolvable.rb
index 09b1795..7b9acc3 100644
--- a/plugins/patches/app/models/resolvable.rb
+++ b/plugins/patches/app/models/resolvable.rb
@@ -7,6 +7,23 @@ require 'thread'
 
 require 'exceptions'
 
+class PackageKitError < BackendException
+  def initialize(description)
+    @description = description
+    super("PackageKit error")
+  end
+
+  def to_xml
+    xml = Builder::XmlMarkup.new({})
+    xml.instruct!
+
+    xml.error do
+      xml.type "PACKAGEKIT_ERROR"
+      xml.description @description
+    end
+  end
+end
+
 class Resolvable
 
   attr_accessor   :resolvable_id,
@@ -124,7 +141,18 @@ public
       proxy = transaction_iface.object
     
       proxy.on_signal(signal.to_s, &block)
-      proxy.on_signal("Error") {|u1,u2| dbusloop.quit }
+      proxy.on_signal("ErrorCode") {|u1,u2| 
+        error_string = "#{u1}: #{u2}"
+        Rails.logger.error error_string
+        dbusloop.quit 
+        raise PackageKitError.new(error_string) 
+      }
+      proxy.on_signal("RepoSignatureRequired") {|u1,u2,u3,u4,u5,u6,u7,u8| 
+        error_string = "Repository #{u2} needs to be signed"
+        Rails.logger.error error_string
+        dbusloop.quit 
+        raise PackageKitError.new(error_string) 
+      }
       proxy.on_signal("Finished") {|u1,u2| dbusloop.quit }
       # Do the call only when all signal handlers are in place,
       # otherwise Finished can arrive early and dbusloop will never

---------------------------------------------------------------------

Following exception will be generated:

<error>
<type>GENERIC</type>
<description>return can't jump across threads</description>
<bug type="boolean">true</bug>
−
<backtrace type="array">
−
<line>
/usr/lib/ruby/site_ruby/1.8/dbus/bus.rb:339:in `introspect_data'
</line>
−
<line>
/usr/lib/ruby/site_ruby/1.8/dbus/bus.rb:507:in `call'
</line>
−
<line>
/usr/lib/ruby/site_ruby/1.8/dbus/bus.rb:507:in `process'
</line>
−
<line>
/usr/lib/ruby/site_ruby/1.8/dbus/bus.rb:468:in `send_sync'
</line>
−
<line>
/usr/lib/ruby/site_ruby/1.8/dbus/bus.rb:335:in `introspect_data'
</line>
−
<line>
/usr/lib/ruby/site_ruby/1.8/dbus/introspect.rb:444:in `introspect'
</line>
−
<line>
/usr/local/src/rails/rest-service/webservice/../plugins/patches/app/models/resolvable.rb:58:in `packagekit_connect'
</line>
−
<line>
/usr/local/src/rails/rest-service/webservice/../plugins/patches/app/models/resolvable.rb:139:in `execute'
</line>
−
<line>
/usr/local/src/rails/rest-service/webservice/../plugins/patches/app/models/patch.rb:15:in `find'
</line>
−
<line>
/usr/local/src/rails/rest-service/webservice/../plugins/patches/app/controllers/patches_controller.rb:45:in `index'
Comment 2 Ladislav Slezák 2009-12-30 14:01:42 UTC
I cannot reproduce it anymore on my machine after applying commit cde1b8ff40f87a9f3021de7a75878c42461962d1.

But it didn't help for Schubi.

Martin, the last time when it hung at my machine it was stuck somewhere in ruby-dbus code. Unfortunately I have lost the backtrace.
Comment 3 Martin Vidner 2010-03-05 16:59:12 UTC
The URL for Lada's commit is http://gitorious.org/opensuse/yast-rest-service/commit/cde1b8ff40f87a9f3021de7a75878c42461962d1

This could be a duplicate of bug 579001 but we should try to reproduce the bug anyway.
Comment 4 Klaus Kämpf 2010-04-15 14:48:13 UTC
Stefan, can you still reproduce it ?
Comment 5 Stefan Schubert 2010-04-16 09:43:43 UTC
Wwith RC3 the system reports "your system is ok" although there is a patch for
installation. This patch will be shown after I have added the key with zypper again.
Comment 6 Ladislav Slezák 2010-04-20 13:57:07 UTC
The problem from comment #5 is a duplicate of bug bnc#559233 (which just has been fixed).

Schubi, could you still reproduce the original problem (DBus hang)? Please, close the bug if not.
Comment 7 Stefan Schubert 2010-04-21 14:44:57 UTC
No I cannot. So I close. Thanks