Ruby 1.9.1 and Mingw (on Windows)

A

Alexey Borzenkov

Hi,

Recently I wanted to see if I could safely move to Ruby 1.9.1, and
wanted to test my rails application for that, when I discovered that
Thin (which uses EventMachine) just hangs up after the first request.
This happens not just with my, but any rails application. During
investigation I found that:

1) EventMachine's test cases hang up immediately after starting. Thin
hangs up somewhere after returning from Connection#receive_data.
2) The hang is happening deep in rb_vm_bugreport, which I could see with
Process Explorer, but it does not display anything in the console. Maybe
once or twice I've seen [BUG] lines with Rails/Thin, but it was very
early in my investigations and I dismissed those, and then later
couldn't reproduce. :-/
3) Thinking there might be something wrong in Ruby itself I tried
executing make check, and indeed, somewhere deep in processing of make
test-all this hang is happening very much reliably for me, although not
on the same dot. Process explorer shows rb_vm_bugreport as the closes
function inside ruby dll.
4) When ruby processes hang up like this, Ctrl+C and Ctrl+Break stop
working (which means signal processing is completely gone), and the only
way to get rid of such process is to kill it with Process Explorer /
Task Manager.

Did anyone else encounter anything like this, or something is extremely
wrong with my msys/mingw or dependencies (taken from gnuwin32)? Seeing
that rubyinstaller is moving to 1.9.1 I'd really like to know if anyone
else experiences hangs like this.

P.S.
Because Ruby 1.8 also manages to sometimes hang up in rb_w32_select (and
100% reliably when doing make test-all), I smell something very fishy
here, and maybe it only happens on my work pc (I'm using a mac at home),
so I'd like more input from other people using mingw.
 
M

M. Edward (Ed) Borasky

Hi,

Recently I wanted to see if I could safely move to Ruby 1.9.1, and
wanted to test my rails application for that, when I discovered that
Thin (which uses EventMachine) just hangs up after the first request.
This happens not just with my, but any rails application. During
investigation I found that:

1) EventMachine's test cases hang up immediately after starting. Thin
hangs up somewhere after returning from Connection#receive_data.
2) The hang is happening deep in rb_vm_bugreport, which I could see with
Process Explorer, but it does not display anything in the console. Maybe
once or twice I've seen [BUG] lines with Rails/Thin, but it was very
early in my investigations and I dismissed those, and then later
couldn't reproduce. :-/
3) Thinking there might be something wrong in Ruby itself I tried
executing make check, and indeed, somewhere deep in processing of make
test-all this hang is happening very much reliably for me, although not
on the same dot. Process explorer shows rb_vm_bugreport as the closes
function inside ruby dll.
4) When ruby processes hang up like this, Ctrl+C and Ctrl+Break stop
working (which means signal processing is completely gone), and the only
way to get rid of such process is to kill it with Process Explorer /
Task Manager.

Did anyone else encounter anything like this, or something is extremely
wrong with my msys/mingw or dependencies (taken from gnuwin32)? Seeing
that rubyinstaller is moving to 1.9.1 I'd really like to know if anyone
else experiences hangs like this.

P.S.
Because Ruby 1.8 also manages to sometimes hang up in rb_w32_select (and
100% reliably when doing make test-all), I smell something very fishy
here, and maybe it only happens on my work pc (I'm using a mac at home),
so I'd like more input from other people using mingw.

Are you building Ruby from source, or using a binary executable? If
you're building it yourself, you could try using less compiler
optimization. Try '-O0 -g' compile flags.
 
A

Alexey Borzenkov

M. Edward (Ed) Borasky said:
Are you building Ruby from source, or using a binary executable? If
you're building it yourself, you could try using less compiler
optimization. Try '-O0 -g' compile flags.

From source, I didn't know there's binary ruby 1.9.1 built with mingw
anywhere right now, besides make test-all should have implied that. :)
If I remember correctly I even tried optflags="-O0" debugflags="-g3
-ggdb" to ensure there are no optimization and as more debug as
possible, and it didn't help much. But I can't be certain, because after
so many recompilations it started interfering with my work and I had to
return to my duties. I think I'll do more tests, but no sooner than
Monday, so I wanted to know how it is for others in the meantime...
 
R

Roger Pack

Did anyone else encounter anything like this, or something is extremely
wrong with my msys/mingw or dependencies (taken from gnuwin32)? Seeing
that rubyinstaller is moving to 1.9.1 I'd really like to know if anyone
else experiences hangs like this.

Do you not get those issues using msvc compiled? What about mingw
compiled 1.8.6?

There was a recent thread on rubyinstaller about it, with nobody going
deep enough to actually determine what's going on :) (the subject had to
do with GCC 4.3).

P.S.
Because Ruby 1.8 also manages to sometimes hang up in rb_w32_select (and
100% reliably when doing make test-all), I smell something very fishy
here, and maybe it only happens on my work pc (I'm using a mac at home),
so I'd like more input from other people using mingw.

I know that one bug was fixed for me re: rb_w32_select not selecting on
"lotsa fd's" but I'd imagine that's unrelated.
http://redmine.ruby-lang.org/issues/show/755
Thanks.
-=r
 
A

Alexey Borzenkov

Roger said:
Do you not get those issues using msvc compiled? What about mingw
compiled 1.8.6?

I don't have Visual Studio 6.0, so I can't build it with msvc the
official way. And in my experience (well, with 1.8.7) ruby compiled with
vs2008 express was too unstable, so not even worth a try.

Mingw compiled 1.8.6 has some strangeness in that make test-all has
tests that sometimes complete normally, and sometimes show up as E or F.
But I never could complete it to the end, because it always hangs up in
rb_w32_select, in one test or the other.
There was a recent thread on rubyinstaller about it, with nobody going
deep enough to actually determine what's going on :) (the subject had to
do with GCC 4.3).

Yeah, I experienced some problems with gcc 4.3 several months ago (not
ruby related though, I wasn't even into ruby at that time), so I fell
back to gcc 3.4.5 (latest mingw that is not 4.3) ever since. But I tried
compiling ruby 1.9.1 with gcc 4.3 once, and it had compilation error in
one of extensions. I was too lazy to investigate, so reverted back to
3.4.5 without even trying to come up with any fix.
I know that one bug was fixed for me re: rb_w32_select not selecting on
"lotsa fd's" but I'd imagine that's unrelated.
http://redmine.ruby-lang.org/issues/show/755

Wow, thanks for the link, I'll be sure to try if it would allow me to
complete ruby 1.8.6 tests...
 
R

Roger Pack

3) Thinking there might be something wrong in Ruby itself I tried
executing make check, and indeed, somewhere deep in processing of make
test-all this hang is happening very much reliably for me, although not
on the same dot. Process explorer shows rb_vm_bugreport as the closes
function inside ruby dll.

I do remember that running make test-all on 1.9 about 4 months ago which
resulted in something like 50 F's then a hang within a process using
tons of RAM, but it's been awhile perhaps things have improved.
In Luis' words "keep in mind that 1.9.1 is completely broken, I hope
1.9.2 will
have better Windows support."

Charlie Savage has been submitting bug reports to core in an attempt to
get make test-all to actually finish. Asking on the one click mailing
list might be useful.

-=r
 
R

Roger Pack

I don't have Visual Studio 6.0, so I can't build it with msvc the
official way. And in my experience (well, with 1.8.7) ruby compiled with
vs2008 express was too unstable, so not even worth a try.

Mingw compiled 1.8.6 has some strangeness in that make test-all has
tests that sometimes complete normally, and sometimes show up as E or F.
But I never could complete it to the end, because it always hangs up in
rb_w32_select, in one test or the other.

I wish we had an easy reproducible test case :) (though I guess the
first test that hangs it might suffice).
A couple of other thoughts: you could try EM using visual studio 2008
(see link:
http://rubyforge.org/pipermail/rubyinstaller-devel/2009-February/000473.html
), also if it hangs you might be able to use gdb against a mingw build
against the live process.
http://eigenclass.org/hiki/ruby+live+process+introspection

Good luck.
-=r
 
R

Roger Pack

I wish we had an easy reproducible test case :) (though I guess the
first test that hangs it might suffice).
A couple of other thoughts: you could try EM using visual studio 2008
(see link:
http://rubyforge.org/pipermail/rubyinstaller-devel/2009-February/000473.html
), also if it hangs you might be able to use gdb against a mingw build
against the live process.
http://eigenclass.org/hiki/ruby+live+process+introspection

Good luck.
-=r

Also trying to build it with trunk (or the daily snapshot) might be
helpful.
-=r
 
R

Roger Pack

Recently I wanted to see if I could safely move to Ruby 1.9.1, and
wanted to test my rails application for that, when I discovered that
Thin (which uses EventMachine) just hangs up after the first request.
This happens not just with my, but any rails application. During
investigation I found that:

1) EventMachine's test cases hang up immediately after starting.

After some investigation, I have confirmed that mingw + 1.9 + EM is a no
go currently. Seems to work all right with 1.8.6 + mingw + EM.

I would recommend the pure ruby EM except it seems to leak on my
machine.
Another thing would be to use rev as a backend to EM.

http://github.com/rogerdpack/rev/tree/master

has the latest and greatest (that compiles on mingw 1.9)
so I'd git clone it
run rake package
then install the .gem file it generates.
Then it's

require 'eventmachine'
then
require 'revem' # override EM to use rev + libev as the backend

Let me know if you try it :)
Cheers!
-=r
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top