view · edit · sidebar · attach · print · history

20160319-fix-and-setup-ruby186-apps-with-modRuby-compiled-against-ruby193

<< 20160701-setup-davaz-com | Index | template >>


Summary

  • First, tried to work web applications on Thinpower with mod_ruby compiled against ruby186 (+oniguruma patches), but it does not work.
  • Next, tried to compile mod_ruby with various patch leveled ruby186, but it also does not work.
  • Finally setup some applications to work ruby186 to work mod_ruby compiled against ruby193 (got some issues, but it works)
  • See Conclusion about current little complicated status

Commits / Patches / Pull Requests

Index


Check current status before update

I've checked current (ruby) status and location before to try fixing it.

  • ch.oddb.org uses /usr/local/bin/ruby193
  • de.oddb.org uses /usr/bin/ruby18
  • ydpm uses /usr/bin/ruby18
  • ydim uses /usr/bin/ruby18
  • mod_ruby compiled against /usr/local/bin/ruby186
$ s -la /usr/local/bin/ruby*                                                   
-rwxr-xr-x 1 root root 2572289 15. Mär 22:43 /usr/local/bin/ruby                
-rwxr-xr-x 1 root root    8094 16. Mär 18:40 /usr/local/bin/ruby186             
lrwxrwxrwx 1 root root       4 14. Dez 2011  /usr/local/bin/ruby193 -> ruby        
$ ls -la /usr/bin/ruby*                                                         
lrwxrwxrwx 1 root root      16 18. Feb 2010  /usr/bin/ruby -> //usr/bin/ruby18  
-rwxr-xr-x 1 root root    6112 30. Jul 2009  /usr/bin/ruby1.9                   
-rwxr-xr-x 1 root root    6104  6. Apr 2009  /usr/bin/ruby18                    
-rwxr-xr-x 1 root root 1244860 16. Mär 18:05 /usr/bin/ruby186                   
-rwxr-xr-x 1 root root     386 18. Feb 2010  /usr/bin/rubyforge
# ldd /usr/lib/apache2/modules/mod_ruby.so                                      
        linux-vdso.so.1 (0x00007ffe2c7ba000)                                    
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0e81731000)          
        librt.so.1 => /lib64/librt.so.1 (0x00007f0e81529000)                    
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f0e81325000)                    
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f0e810ed000)              
        libm.so.6 => /lib64/libm.so.6 (0x00007f0e80de9000)                      
        libc.so.6 => /lib64/libc.so.6 (0x00007f0e80a3b000)                      
        /lib64/ld-linux-x86-64.so.2 (0x00007f0e81dd3000) 

mod_ruby undefiend symbol error

I've tried to avoid this error, it seems good. But after this, Apache causes still Segmentation fault.

$ sudo /etc/init.d/apache2 restart                                 
* apache2 has detected an error in your setup:                                  
apache2: Syntax error on line 155 of /etc/apache2/httpd.conf: Syntax error on line 3 of /etc/apache2/modules.d/21_mod_ruby.conf: Cannot load /usr/lib64/apache2/modules/mod_ruby186.so into server: /usr/lib64/apache2/modules/mod_ruby186.so: undefined symbol: rb_block_lambda
* ERROR: apache2 failed to stop                                                 

related issues

Avoid-rb_block_lambda undefined issue

mod_ruby/request.c

1774 //#if RUBY_VM || RUBY_RELEASE_CODE > 20030616
1775 //  plain_cleanup = rb_block_lambda();
1776 //#else
1777   plain_cleanup = rb_f_lambda();
1778 //#endif

Compile various patch level ruby 1.8.6

I've found old rubies at here:
http://ftp.ruby-lang.org/pub/ruby/1.8/

And tried to compile with various patch level ruby186 with oniguruma patch. But its are also same result.

Fix errors reported in Apache error_log

I've noticed that there are many various errors in error_log of apache. So, I've reduced these.

auto_gem

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- auto_gem (LoadError)
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/trans_handler.rb:14: warning: already initialized constant CONFIG_PATH
/usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/trans_handler.rb:18: warning: already initialized constant HANDLER_URI

Set RUBYOPT in config files of apache.

SetEnv RUBYOPT ''

And to avoid this error in ruby application on Gentoo, often I do this:

$ cat /etc/conf.d/99ruby
RUBYOPT=""

I've also set this global environment variable on Thinpower.

sbsm/trans_handler location

[Sat Mar 19 00:06:08 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- sbsm/trans_handler (LoadError)
[Sat Mar 19 00:06:08 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
[Sat Mar 19 00:06:08 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
[Sat Mar 19 00:06:08 2016] [error] mod_ruby: failed to require sbsm/trans_handler
[Sat Mar 19 00:06:08 2016] [error] mod_ruby: error in ruby       

First, I've tried to sbsm installed to ruby1.9.3 and mod_ruby compiled against 1.9.3 for de.oddb.org. Because currently mod_ruby is compiled against 1.9.3 and some application such as ch.oddb.org work fine.

RubyAddPath /usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib

But, de.oddb.org/ydpm/ydim doesn't work. So, then I've tried to use sbsm installed for ruby1.8 (in site_ruby).

Apache config files (/etc/apache2/vhosts.d/)

  • 10.de.oddb.org.conf
  • ydim.ywesee.com.conf
  • ydpm.ywesee.com.conf
RubyAddPath RubyAddPath /usr/lib64/ruby/site_ruby/1.8/ 

This cases still some issues.

Make change Ruby 1.8.6 applications to work

file encoding issue on rockit

rockit in site_ruby (in ruby 1.8) had issues to work for mod_ruby compiled against ruby 1.9.3.

[Sat Mar 19 00:07:06 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': /usr/lib64/ruby/site_ruby/1.8/rockit/token.rb:138: invalid multibyte char (US-ASCII) (SyntaxError)
[Sat Mar 19 00:07:06 2016] [error] mod_ruby: /usr/lib64/ruby/site_ruby/1.8/rockit/token.rb:138: syntax error, unexpected '~', expecting ')'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:     super("EOF", "\xa4~~\xa4\xa4~^^~" + rand(1e10).inspect)
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:                     ^              
[Sat Mar 19 00:07:06 2016] [error] mod_ruby: /usr/lib64/ruby/site_ruby/1.8/rockit/token.rb:138: invalid multibyte char (US-ASCII)
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/lib64/ruby/site_ruby/1.8/rockit/grammar.rb:1:in `<top (required)>'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/lib64/ruby/site_ruby/1.8/rockit/lalr_parsetable_generator.rb:1:in `<top (required)>'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/lib64/ruby/site_ruby/1.8/rockit/rockit.rb:2:in `<top (required)>'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/lib64/ruby/site_ruby/1.8/sbsm/trans_handler.rb:5:in `<top (required)>'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 00:07:06 2016] [error] mod_ruby: failed to require sbsm/trans_handler
[Sat Mar 19 00:07:06 2016] [error] mod_ruby: error in ruby 

Then, Add 'encoding: utf-8' and set fileencoding as utf-8 (:set fileencoding=utf-8, in vim)

/usr/lib64/ruby/site_ruby/1.8/rockit/token.rb                                   
/usr/lib64/ruby/site_ruby/1.8/rockit/rockit_grammars_parser.rb  

Encoding module

Encoding is Class in ruby 1.9.3, but encoding in site_ruby/1.8 defines as Module.

[Sat Mar 19 02:26:24 2016] [error] mod_ruby: error in ruby                      
[Sat Mar 19 02:26:24 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': Class is not a module (TypeError)
[Sat Mar 19 02:26:24 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 02:26:24 2016] [error] mod_ruby:   from /usr/lib64/ruby/site_ruby/1.8/encoding/character/utf-8.rb:5:in `<top (required)>'
[Sat Mar 19 02:26:24 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 02:26:24 2016] [error] mod_ruby:   from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
[Sat Mar 19 02:26:24 2016] [error] mod_ruby:   from /var/www/de.oddb.org/doc/index.rbx:6:in `<top (required)>'
[Sat Mar 19 02:26:24 2016] [error] mod_ruby:   from /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `load'
[Sat Mar 19 02:26:24 2016] [error] mod_ruby:   from /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `handler'

Then, edit index.rbx file in /var/www/de.oddb.org/doc/index.rbx

  • Add encoding: utf-8
  • Comment out encoding/character/utf-8

Conclusion

  • ch.oddb.org works (druby) with ruby1.9.3 (/usr/local/bin/ruby193)
  • de.oddb.org/ydpm/ydim/ (druby) work with ruby 1.8.7 (/usr/bin/ruby18)
  • mod_ruby (in /usr/lib64/apache/modules/mod_ruby.so) is compield with ruby 1.9.3
  • ch.oddb.org uses SBSM from /usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib
  • de.oddb.org uses SBSM from /usr/lib64/ruby/site_ruby/1.8/
  • de.oddb.org depends libraries in /usr/lib64/ruby/site_ruby (not installed with rubygems) and uses also gems in /usr/lib64/ruby/gems/1.8/gems
  • ch.oddb.org and de.oddb.org both (and other all ruby applications) uses same mod_ruby compield against 1.9.3
  • Request is handled in world of ruby 1.9.3, but in de.oddb.org, requeest comes via SBSM for ruby 1.8.6, passed to druyb process (ruby 1.8.7)

There are some strange small issues (in de.oddb.org), but ch.oddb.org, de.oddb.org, ydim and ydpm works in above condition for now.
It is very complicated and isn't maintainable, So It has to be fix with more good setup, as soon as possible.

view · edit · sidebar · attach · print · history
Page last modified on March 19, 2016, at 10:29 PM