Project

General

Profile

Actions

Bug #9922

closed

Compiling Ruby 1.9.3p194 from source code with openssl crashe

Added by psaxena (Pooja Saxena) almost 10 years ago. Updated almost 10 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [i386-mswin32_90]
[ruby-core:63008]

Description

Hi,

I am trying to compile ruby from source code. And i am using thin server. Problem is when i am trying to start thin with ssl option by specifying :-

ruby bin/thin --ssl -a 127.0.0.1 -p 44466 start

I starts the server, but on accessing the https://localhost:44466. It crashes ruby and gives the error on console and a popup comes saying ruby interpretor has stopped working.

"This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information."

and in windows even logs i see :--

Faulting application name: ruby.exe, version: 1.9.3.194, time stamp: 0x5154804d
Faulting module name: MSVCR90.dll, version: 9.0.30729.4940, time stamp: 0x4ca2ef57
Exception code: 0x40000015
Fault offset: 0x0005beae
Faulting process id: 0x11d4
Faulting application start time: 0x01cf7fb6cca849aa
Faulting application path: C:\Ruby19\bin\ruby.exe
Faulting module path: C:\Windows\WinSx\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\MSVCR90.dll
Report Id: 47c368b9-ebaa-11e3-8cd8-8c89a5d53bc0`

I've compiled ruby with diff versions of openssl, but same application crash error. I am on windows platform and compiliing using microsoft visual studio8. Please let me know if i am missing some steps. how can remove/avoid this 'msvcr90.dll' error.

platform :- windows7
compiler :- Microsoft visual studio9
Ruby :- ruby1.9.3p194
Openssl :- openssl 1.0.0d/openssl 1.0.0e


Files

scrreshot ruby crash.png (32.7 KB) scrreshot ruby crash.png psaxena (Pooja Saxena), 06/09/2014 08:23 AM
ruby exe depedency.png (255 KB) ruby exe depedency.png psaxena (Pooja Saxena), 06/10/2014 07:15 AM
libeay dependency.png (267 KB) libeay dependency.png psaxena (Pooja Saxena), 06/10/2014 07:15 AM
ssleay dependency.png (268 KB) ssleay dependency.png psaxena (Pooja Saxena), 06/10/2014 07:15 AM
console.png (50.2 KB) console.png psaxena (Pooja Saxena), 06/11/2014 06:36 AM

Updated by usa (Usaku NAKAMURA) almost 10 years ago

  • Status changed from Open to Feedback
  • Priority changed from 5 to Normal
  1. Your ruby is too old. Please check p547, and report if you still have the same problem.
  2. When ruby crashes, ruby outputs backtrace to the console. Please attach it.

Updated by psaxena (Pooja Saxena) almost 10 years ago

Usaku NAKAMURA wrote:

  1. Your ruby is too old. Please check p547, and report if you still have the same problem.
  2. When ruby crashes, ruby outputs backtrace to the console. Please attach it.

I tried compiling with p547 also. I get same error. And in ruby console I only see the msg below and no backtrace.

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

I searched around for this defect, I found out it while compiling on windows with visual studi, this occurs bcause of some dependency libraries.
refernce link :- http://code.activestate.com/lists/ruby-talk/32371/

I tried installer for p547, it worked. but when complied same p547 from source i got same error.

Updated by usa (Usaku NAKAMURA) almost 10 years ago

Pooja Saxena wrote:

I tried compiling with p547 also. I get same error. And in ruby console I only see the msg below and no backtrace.

Oh, really?
I guess that the message ("This application ...") is shown in a popup window. Isn't it?
The console I meant is your command prompt which you ran "ruby bin/thin ...".
After a crash of ruby, it reports "[BUG]" message with backtrace usually.

Updated by psaxena (Pooja Saxena) almost 10 years ago

Usaku NAKAMURA wrote:

Pooja Saxena wrote:

I tried compiling with p547 also. I get same error. And in ruby console I only see the msg below and no backtrace.

Oh, really?
I guess that the message ("This application ...") is shown in a popup window. Isn't it?
The console I meant is your command prompt which you ran "ruby bin/thin ...".
After a crash of ruby, it reports "[BUG]" message with backtrace usually.

Yes only this comes in console without any backtrace. Pop only only shows "ruby193p194 has stopped working". I am attaching screenshot of pop-up for your reference

Updated by psaxena (Pooja Saxena) almost 10 years ago

Any update on this??

Updated by usa (Usaku NAKAMURA) almost 10 years ago

I have not been able to reproduce this problem at this time.
From the information that is provided by you, I can not debug unfortunately.

It should be noted, ruby ​​1.9.3 has ended the normal maintenance phase already,
we do not plan to release bug fixes without security issues.
If possible, please check ruby 2.1 or 2.0.0, and report if the problem still occurs.

Updated by psaxena (Pooja Saxena) almost 10 years ago

due to other projects dependecies, I am bound to use that version only. From all the informaiton i explored, got to know that it has to do with compiling dependency libraries (\MSVCR90.dll) same msvcrt version. And that is working correct on mingw but not on mswin.

If you can look on cade which deals with msvcrt for mingw and mswin, may be can help.

Updated by luislavena (Luis Lavena) almost 10 years ago

Was OpenSSL also compiled with the same version of Visual Studio?

Thin depends on both OpenSSL and Eventmachine library, the last being a bit problematic for some versions of Visual Studio (and also MinGW).

Can you confirm all the dependencies were compiled with the same compiler?

Updated by psaxena (Pooja Saxena) almost 10 years ago

Yes I compiled openssl also with same version of visual studio. Did not do anything related to event machine library

Updated by phasis68 (Heesob Park) almost 10 years ago

You can check the MSVCRT dependencies with Dependency Walker(http://www.dependencywalker.com).

Please check the dependency of ruby.exe, libeay32.dll and ssleay32.dll.

Updated by psaxena (Pooja Saxena) almost 10 years ago

Dont know much about dependency checking, hence did not get much. But understood that three of them depends on both msvcrt.dll and msvcr90.dll. But logs in windows say faluting module path to msvcr90.dll. Attaching screenshot of dependency walker result for the reference

Updated by luislavena (Luis Lavena) almost 10 years ago

Pooja Saxena wrote:

Yes I compiled openssl also with same version of visual studio. Did not do anything related to event machine library

thin depends on eventmachine, if you haven't compiled eventmachine dependency, can you tell us the specific versions installed of the gems thin and eventmachine?. Please copy and paste the output of "gem list thin" and "gem list eventmachine"

Thank you.

Updated by phasis68 (Heesob Park) almost 10 years ago

It seems that Just-In-Time Debugging of Visual Studio inhibit the backtrace output of ruby.exe.

You can get the full backtrace by disabling Just-In-Time Debugging.

Refer to http://msdn.microsoft.com/en-us/library/5hs4b7a6(v=vs.90).aspx

Also, to disable Program Has Stopped Working Error Dialog

For Vista / Win7 / Server 2008 etc:

  1. Open start menu and type “gpedit.msc”. The Local Group Policy editor will appear.
  2. Navigate to Computer Configuration / Administrative Templates / Windows Components / Windows Error Reporting
  3. Edit the entry for “Prevent display of the user interface for critical errors”
  4. Set it to Enabled.

For Windows XP:

  1. Open start menu, click on Run, and type “gpedit.msc”. The Group Policy editor will appear.
  2. Navigate to Computer Configuration / Administrative Templates / System / Error Reporting
  3. Edit the entry for “Display error notification”
  4. Set it to Enabled.

Updated by psaxena (Pooja Saxena) almost 10 years ago

debugger opens blank file. Also tried installing eventmachine and thin again with version used in my application. Here is gem list:-

gem list

*** LOCAL GEMS ***

bigdecimal (1.1.0)
bundler (1.3.4)
daemons (1.1.9)
em-synchrony (1.0.0)
eventmachine (1.0.1)
http_parser.rb (0.5.3)
io-console (0.3)
json (1.5.4)
minitest (2.5.1)
psych (1.3.4)
rack (1.5.2)
rake (0.9.2.2)
rdoc (3.9.4)
thin (1.5.0)

Updated by phasis68 (Heesob Park) almost 10 years ago

Did you try to disable "Program Has Stopped Working Error" dialog?

For Vista / Win7 / Server 2008 etc:

  1. Open start menu and type “gpedit.msc”. The Local Group Policy editor will appear.
  2. Navigate to Computer Configuration / Administrative Templates / Windows Components / Windows Error Reporting
  3. Edit the entry for “Prevent display of the user interface for critical errors”
  4. Set it to Enabled.

Updated by psaxena (Pooja Saxena) almost 10 years ago

Yes i did. It dod not show pop-up. but in command prompt i got same error only. And nothing in debugger

Updated by phasis68 (Heesob Park) almost 10 years ago

I am not sure what you mean by "nothing in debugger".

You must run ruby on command prompt without any debugger.

Updated by psaxena (Pooja Saxena) almost 10 years ago

'Nothing in debugger' by this i mean, when i see pop-up msg that ruby has stoppped working, it gives me option to debugor close the program. I choose to debug with Visual studio8 with Just in time debugger option enabled. But i did not see any log or trace for error.

Please let me know if i am missing anything to see it. I did all steps mentioned above

Updated by phasis68 (Heesob Park) almost 10 years ago

Are you sure you disabled "Program Has Stopped Working Error" dialog and Just-in-Time Debugging?

Then you can not see any pop-up message.

Updated by psaxena (Pooja Saxena) almost 10 years ago

Yes i did. By doing that, Pop-up did not come, but visual studio also did not show anyhitng.

Updated by phasis68 (Heesob Park) almost 10 years ago

I cannot understand what you want to see with Visual Studio.

In cmd.exe console, you would run

C:>ruby bin/thin --ssl -a 127.0.0.1 -p 44466 start

When ruby crashes, ruby outputs backtrace to the console.

There is nothing to do with Visual Studio.

Updated by psaxena (Pooja Saxena) almost 10 years ago

Yes, this is what i tried. But console only displays one line "This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information." No other backtrace. Attaching screenshot for your reference

Updated by phasis68 (Heesob Park) almost 10 years ago

I saw a something similar issue at https://groups.google.com/forum/#!topic/faye-users/BdbRYIkp1oo

The issuer solved by using MinGW Ruby instead of MSVC Ruby.

If you must use MSVC Ruby, you may need to debug ruby with WinDbg debugger to find out the problem.

Refer to
http://www.windbg.org/
http://msdn.microsoft.com/en-us/library/hh406283.aspx

Updated by psaxena (Pooja Saxena) almost 10 years ago

Yes it does not accur with mingw. For ruby 1.9.3p547 it tried both installer and compiling from source. It showed the same error on compiling from source(mswin). But, worked from installer(mingw). Did anyone else tried to build ruby from source and did not face this issue, if yes I want to cross check with compiling process.

Summarizing what i am doing:-

  1. Builing openssl from source

  2. downloaded other modules zlib, iconv, libxml2, libxslt

  3. Set RUBY_PATH, INCLUDE, LIB pointintg to lib and include of zlib and openssl

    set RUBY_PATH=C:\Ruby19
    set INCLUDE=%INCLUDE%;......\zlib\include;......\openssl\include;..\openssl\include;......\iconv\include
    set LIB=%LIB%;......\zlib\lib;......\openssl\lib\win32;......\iconv\libwin32\configure.bat --prefix=%RUBY_PATH%

  4. extract source of ruby and run from visual studio cmd prompt win32\configure.bat --prefix=%RUBY_PATH%

  5. nmake

  6. nmake install

  7. copy openssl and iconv dll to ruby bin

  8. install thin, psych evenmachine gems

Updated by phasis68 (Heesob Park) almost 10 years ago

OK. I have reproduced this crash.

And I found the cause of this issue.
The crash occurred in the following line of ed.cpp of eventmachine gem.

	#ifdef WITHOUT_SSL
	throw std::runtime_error ("Encryption not available on this event-machine");
	#endif

The eventmachine gem was built with WITHOUT_SSL macro on MSVC Compiler.

Here is a patch for eventmachine/ext/extconf.rb

diff --git a/extconf.rb b/extconf.rb.new
index 448802a..27a5b8b 100644
--- a/extconf.rb
+++ b/extconf.rb.new
@@ -25,7 +25,7 @@ end
 def manual_ssl_config
   ssl_libs_heads_args = {
     :unix => [%w[ssl crypto], %w[openssl/ssl.h openssl/err.h]],
-    :mswin => [%w[ssleay32 eay32], %w[openssl/ssl.h openssl/err.h]],
+    :mswin => [%w[ssleay32 libeay32], %w[openssl/ssl.h openssl/err.h]],
   }

   dc_flags = ['ssl']

Conclusion: this is a Third Party's Issue.

Updated by usa (Usaku NAKAMURA) almost 10 years ago

  • Status changed from Feedback to Third Party's Issue

Thank you all for resolving this issue.
(I was trying to make a reproduction environment, but I was not in time.)

Updated by psaxena (Pooja Saxena) almost 10 years ago

I only have to edit this gem, or it needs to be compile again?

Updated by phasis68 (Heesob Park) almost 10 years ago

You have two options.

1 Build gem for yourself

cd C:\Ruby19\lib\ruby\gems\1.9.1\gems\eventmachine-1.0.3\ext
edit extconf.rb as above
>ruby extconf.rb
>nmake
>copy rubyeventmachine.so C:\Ruby19\lib\ruby\gems\1.9.1\gems\eventmachine-1.0.3\lib

2 Issue bug to https://github.com/eventmachine/eventmachine/issues, wait until the bug fixed and gem install again.

Updated by psaxena (Pooja Saxena) almost 10 years ago

Tried building gem for myself. It is giving me error of dev tools. Though i do hace dev-kit installed and pat also has been set. Below is the error i am getting :-

C:\Ruby19\lib\ruby\gems\1.9.1\gems\eventmachine-1.0.3\ext>ruby extconf.rb
checking for main() in -lssl... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Users/poojasax/.pik/rubies/Ruby193/bin/ruby
--with-openssl-config
--without-openssl-config
--with-pkg-config
--without-pkg-config
--with-ssl-dir
--without-ssl-dir
--with-ssl-include
--without-ssl-include=${ssl-dir}/include
--with-ssl-lib
--without-ssl-lib=${ssl-dir}/lib
--with-ssllib
--without-ssllib
C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:381:in try_do': Th e compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:461:in try_link0'
from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:476:in
try_link' from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:619:in try_func'
from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:845:in
block in have_library' from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:790:in block in checking_for'
from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in
block (2 levels) in postpone' from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in open'
from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in
block in postpone' from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in open'
from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:280:in
postpone' from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:789:in checking_for'
from C:/Users/poojasax/.pik/rubies/Ruby193/lib/ruby/1.9.1/mkmf.rb:840:in
have_library' from extconf.rb:5:in block in check_libs'
from extconf.rb:5:in each' from extconf.rb:5:in all?'
from extconf.rb:5:in check_libs' from extconf.rb:39:in manual_ssl_config'
from extconf.rb:61:in `'

Updated by phasis68 (Heesob Park) almost 10 years ago

I guess you have multiple ruby environments.

You must run c:\Ruby19\bin\ruby.exe with proper environment variables.

Try with something like this:

set PATH=c:\Ruby19\bin;%PATH%
set INCLUDE=%INCLUDE%;c:\work\zlib-1.2.5\include;c:\wokr\libxml2-2.7.8.win32\include;c:\usr\local\ssl\include;c:\work\iconv-1.9.2.win32\include
set LIB=%LIB%;c:\work\zlib-1.2.5\lib;c:\usr\local\ssl\lib;c:\work\iconv-1.9.2.win32\lib;c:\wokr\libxml2-2.7.8.win32\lib

Updated by psaxena (Pooja Saxena) almost 10 years ago

Yep that was the issue. I removed the other ruby then tried. I created rubyeventmachine.so and i moved it. But again faced same issue. Is there anything which is missing?

Can you share the gem files which are working for you?

Also which ruby you tried 1.9.3p194 or 1.9.3p547?

Updated by phasis68 (Heesob Park) almost 10 years ago

What is the output of ruby extconf.rb?
The first two lines should be yes

checking for main() in ssleay32.lib... yes
checking for main() in libeay32.lib... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... yes
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in kernel32.lib... yes
checking for main() in rpcrt4.lib... yes
checking for main() in gdi32.lib... yes
creating Makefile

The ruby version is not relevant to this issue.

I tried Ruby 1.9.3p545 with Visual Studio 2010 Express.

Updated by psaxena (Pooja Saxena) almost 10 years ago

It came like this

C:\Ruby19\lib\ruby\gems\1.9.1\gems\eventmachine-1.0.1\ext>ruby extconf.rb
checking for main() in ssleay32.lib... yes
checking for main() in libeay32.lib... yes
checking for openssl/ssl.h... yes
checking for openssl/err.h... yes
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... yes
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in kernel32.lib... yes
checking for main() in rpcrt4.lib... yes
checking for main() in gdi32.lib... yes
creating Makefile

C:\Ruby19\lib\ruby\gems\1.9.1\gems\eventmachine-1.0.1\ext>

Updated by phasis68 (Heesob Park) almost 10 years ago

You must remove old ed.obj with nmake clean

> nmake clean
> nmake 

Updated by psaxena (Pooja Saxena) almost 10 years ago

Tried it again after removing other ruby. It worked :)

Thanks all for your help.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0