Bug 624029

Summary: ruby fails to load the thread module
Product: Red Hat Enterprise Linux 7 Reporter: Frantisek Reznicek <freznice>
Component: distributionAssignee: RHEL Program Management <pm-rhel>
Status: CLOSED DUPLICATE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: eng-i18n-bugs, esammons, mmorsi, pcormier, vondruch
Target Milestone: alphaKeywords: RHELNAK
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-14 06:58:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Reproduction log
none
Patch for this issue none

Description Frantisek Reznicek 2010-08-13 13:11:19 UTC
Description of problem:

Ruby language fails to load thread module on x86_64 when both 32 and 64 bits ruby-libs packages are installed. There might be other modules affected.

[root@dhcp-27-227 bz]# rpm -qa | grep ^ruby | sort
ruby-1.8.7.299-3.el6.x86_64
ruby-irb-1.8.7.299-3.el6.x86_64
ruby-libs-1.8.7.299-3.el6.i686
ruby-libs-1.8.7.299-3.el6.x86_64
ruby-qmf-0.7.946106-5.el6.x86_64
ruby-qpid-0.7.946106-2.el6.x86_64

[root@dhcp-27-227 bz]# irb
irb(main):001:0> require 'thread'
LoadError: /usr/lib/ruby/1.8/thread.so: wrong ELF class: ELFCLASS32 - /usr/lib/ruby/1.8/thread.so
        from /usr/lib/ruby/1.8/thread.so
        from /usr/lib/ruby/1.8/thread.rb:5
        from (irb):1:in `require'
        from (irb):1
        from :0

When the ruby-libs-1.8.7.299-3.el6.i686 is removed everything starts to work as expected:

[root@dhcp-27-227 bz]# rpm -e ruby-libs-1.8.7.299-3.el6.i686
[root@dhcp-27-227 bz]# rpm -qa | grep ^ruby | sort
ruby-1.8.7.299-3.el6.x86_64
ruby-irb-1.8.7.299-3.el6.x86_64
ruby-libs-1.8.7.299-3.el6.x86_64
ruby-qmf-0.7.946106-5.el6.x86_64
ruby-qpid-0.7.946106-2.el6.x86_64
[root@dhcp-27-227 bz]# ./qc_client.rb
[root@dhcp-27-227 bz]# echo $?
0
[root@dhcp-27-227 bz]# irb
irb(main):001:0> require 'thread'
=> true




Version-Release number of selected component (if applicable):
ruby-1.8.7.299-3.el6.x86_64
ruby-irb-1.8.7.299-3.el6.x86_64
ruby-libs-1.8.7.299-3.el6.i686
ruby-libs-1.8.7.299-3.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1. install above packages
2. issue "irb"
3. type "require 'thread'"
  
Actual results:
Ruby fails to load thread module when ruby-libs-1.8.7.299-3.el6.i686 is installed.

Expected results:
Ruby should load threading module regardless of presence of ruby-libs-1.8.7.299-3.el6.i686.

Additional info:

Comment 2 RHEL Program Management 2010-08-13 13:38:07 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 3 RHEL Program Management 2010-08-18 21:31:34 UTC
Thank you for your bug report. This issue was evaluated for inclusion
in the current release of Red Hat Enterprise Linux. Unfortunately, we
are unable to address this request in the current release. Because we
are in the final stage of Red Hat Enterprise Linux 6 development, only
significant, release-blocking issues involving serious regressions and
data corruption can be considered.

If you believe this issue meets the release blocking criteria as
defined and communicated to you by your Red Hat Support representative,
please ask your representative to file this issue as a blocker for the
current release. Otherwise, ask that it be evaluated for inclusion in
the next minor release of Red Hat Enterprise Linux.

Comment 4 Jim Meyering 2010-08-30 08:04:42 UTC
Hi Frantisek,

Thanks for the report.
FYI, I tried to reproduce this on rawhide and was unable even to install the i686 package alongside the x86_64 one:

$ yum -y install ruby-libs-1.8.7.302-1.fc15.i686
...
Transaction Check Error:
  file /usr/share/doc/ruby-libs-1.8.7.302/ext/dl/dlconfig.rb from install of ruby-libs-1.8.7.302-1.fc15.i686 conflicts with file from package ruby-libs-1.8.7.302-1.fc15.x86_64

I've Cc'd mmorsi, since he's been doing a lot of ruby packaging work on the Fedora side.

If you know of customers for whom it is important to have both libraries installed, please let us know.

Comment 5 Mo Morsi 2010-08-30 10:10:14 UTC
I am also unable to legitimately install ruby-libs i686 and x86_64 side by side on Fedora 13. Both yum and rpm complain about conflicts between the versions. How are you installing these packages simultaneously?

To try to reproduce the issue I yum installed ruby and then rpm -ivh --force the ruby-libs.i686 rpm (yum installing the necessary dependencies before hand). I could not reproduce the error in either ruby 1.8.6 or ruby 1.8.7.299-4. In both cases "require 'thread'" executed and returned successfully.

If this is a issue in RHEL I would guess that this is due to the search paths being intermingled, the i686 libs will have been written to dirs where the x86_64 ruby interpreter will pick them up, but will throw an exception when doing so due to the incompatible binary formats. I'm not sure if its an issue without more information though, it doesn't seem installing both the 32 and 64 bit versions of ruby-libs is currently supported, though perhaps that could be changed someday by changing the default search paths (perhaps a good feature candidate for the Ruby 1.9 rpms currently in progress, see ruby-sig)

Comment 6 Vít Ondruch 2011-01-04 15:30:23 UTC
Created attachment 471681 [details]
Reproduction log

This error can be reproduced only on RHEL. See the attached Ruby.log

Comment 7 Vít Ondruch 2011-01-04 15:46:02 UTC
Created attachment 471687 [details]
Patch for this issue

The attached patch should fix this issue. Could you please review it?

Comment 8 Jim Meyering 2011-01-05 13:11:18 UTC
Hi Vit,

Thanks for working on this.  It is good that your patch would move RHEL's
ruby installation closer to that of Fedora (and upstream), ...
However, I'm reluctant to make the changes you propose in comment #7,
since that would change ruby's search path, which may well impact customers,
while the underlying problem we're trying to address here appears to affect
*no* customer (no one replied to comment #4).

It all depends on whether being able to install ruby-libs i686
and x86_64 side by side is important enough to risk the proposed change.
Unless we can show a real need for a multi-arch installation, I think
it's not worth the risk.

Comment 9 Frantisek Reznicek 2011-01-18 08:13:41 UTC
Hi all,
I'm sorry I did not get notified, that's why I'm replying late.

a] The problem is in ruby-libs and in el6 both (32 and 64) variants can be
installed at once (side by side):


  [root@dhcp-26-168 ~]# rpm -qa | grep ruby-libs
  ruby-libs-1.8.7.299-4.el6.x86_64
  [root@dhcp-26-168 ~]#
  [root@dhcp-26-168 ~]#
  [root@dhcp-26-168 ~]#
  [root@dhcp-26-168 ~]# irb
  irb(main):001:0> require 'thread'
  => true
  irb(main):002:0> [root@dhcp-26-168 ~]#
  [root@dhcp-26-168 ~]# yum install ruby-libs.i686
  Loaded plugins: presto, rhnplugin
  This system is not subscribed to any channels.
  RHN channel support will be disabled.
  Setting up Install Process
  Resolving Dependencies
  --> Running transaction check
  ---> Package ruby-libs.i686 0:1.8.7.299-4.el6 set to be updated
  --> Finished Dependency Resolution

  Dependencies Resolved

 
============================================================================================================================================
  Package                          Arch                        Version         
                       Repository                       Size
 
============================================================================================================================================
  Installing:
  ruby-libs                        i686                        1.8.7.299-4.el6 
                       rhel-brq                        1.6 M

  Transaction Summary
 
============================================================================================================================================
  Install       1 Package(s)
  Upgrade       0 Package(s)

  Total download size: 1.6 M
  Installed size: 5.6 M
  Is this ok [y/N]: y
  Downloading Packages:
  Setting up and reading Presto delta metadata
  Processing delta metadata
  Package(s) data still to download: 1.6 M
  ruby-libs-1.8.7.299-4.el6.i686.rpm                                           
                                       | 1.6 MB     00:00
  Running rpm_check_debug
  Running Transaction Test
  Transaction Test Succeeded
  Running Transaction
    Installing     : ruby-libs-1.8.7.299-4.el6.i686                            
                                                          1/1

  Installed:
    ruby-libs.i686 0:1.8.7.299-4.el6

  Complete!
  [root@dhcp-26-168 ~]# irb
  irb(main):001:0> require 'thread'
  LoadError: /usr/lib/ruby/1.8/thread.so: wrong ELF class: ELFCLASS32 -
/usr/lib/ruby/1.8/thread.so
          from /usr/lib/ruby/1.8/thread.so
          from /usr/lib/ruby/1.8/thread.rb:5
          from (irb):1:in `require'
          from (irb):1
          from :0
  irb(main):002:0>
  irb(main):003:0* irb(main):003:0>
  irb(main):004:0* quit
  [root@dhcp-26-168 ~]#
  [root@dhcp-26-168 ~]# rpm -qa | grep ruby-libs
  ruby-libs-1.8.7.299-4.el6.i686
  ruby-libs-1.8.7.299-4.el6.x86_64

b] Severity of the issue

Honestly I triggered this issue quite a time ago without explicitly installing 
ruby-libs.i686 a 32 bit package requested 32 bit ruby-libs and then ruby-qpid
(part of MRG/M) stopped working.

I believe this (side by side) configuration is valid and in this case ruby
scripts should remain working.

c] Fix proposal
I think if Vit's fix is big change then other way is to avoid ruby-libs
installable side by side at rpm level.

Comment 10 Vít Ondruch 2011-01-20 09:00:12 UTC
Hi Jim,

After discussion with Frantisek, after check of his logs, it appears that this bug was triggered by manual intervention, i.e. ruby-libs.i686 were installed manually and the reason is not clear, but it was probably mistake.

I would suggest to close this issue, or better to schedule it for another release (RHEL7?), because we know that this issue exists and might strike somebody else one day.

Comment 11 Jim Meyering 2011-01-20 09:18:42 UTC
Hi Vit,

Thanks for the follow-up.
I've deferred it to RHEL7.

Comment 12 Vít Ondruch 2011-02-04 08:51:43 UTC
There might be common solution with #674787.

Comment 13 Vít Ondruch 2011-07-14 06:58:13 UTC

*** This bug has been marked as a duplicate of bug 674787 ***