# Ruby 1.9.1 and Mingw (on Windows)

**URL:** <https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853>\
**Category:** Ruby\
**Created:** [April 18, 2009, 12:05pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853 "2009-04-18T12:05:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![snaury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@snaury](https://www.ruby-forum.com/u/snaury)\
**Post date:** [April 18, 2009, 12:05pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853/1 "2009-04-18T12:05:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![snaury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@snaury](https://www.ruby-forum.com/u/snaury)\
**Post date:** [April 18, 2009, 4:14pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853/2 "2009-04-18T16:14:04Z")

</div>

On Sat, Apr 18, 2009 at 3:05 AM, Alexey B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 1. The hang is happening deep in rb\_vm\_bugreport, which I could see with  
> working (which means signal processing is completely gone), and the only  
> 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.  
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

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.

> 

–  
M. Edward (Ed) Borasky  
[http://www.linkedin.com/in/edborasky](http://www.linkedin.com/in/edborasky)

I’ve never met a happy clam. In fact, most of them were pretty steamed.

---

<div class="post-metadata">

**Author:** ![snaury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@snaury](https://www.ruby-forum.com/u/snaury)\
**Post date:** [April 18, 2009, 4:31pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853/3 "2009-04-18T16:31:42Z")

</div>

M. Edward (Ed) Borasky wrote:

> 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…

---

<div class="post-metadata">

**Author:** ![snaury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@snaury](https://www.ruby-forum.com/u/snaury)\
**Post date:** [April 18, 2009, 5:46pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853/4 "2009-04-18T17:46:57Z")

</div>

> 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](http://redmine.ruby-lang.org/issues/show/755)  
Thanks.  
-=r

---

<div class="post-metadata">

**Author:** ![snaury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@snaury](https://www.ruby-forum.com/u/snaury)\
**Post date:** [April 18, 2009, 11:35pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853/5 "2009-04-18T23:35:25Z")

</div>

Roger P. wrote:

> 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](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…

---

<div class="post-metadata">

**Author:** ![snaury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@snaury](https://www.ruby-forum.com/u/snaury)\
**Post date:** [April 20, 2009, 3:55pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853/6 "2009-04-20T15:55:41Z")

</div>

> 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](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](http://eigenclass.org/hiki/ruby+live+process+introspection)

Good luck.  
-=r

---

<div class="post-metadata">

**Author:** ![snaury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@snaury](https://www.ruby-forum.com/u/snaury)\
**Post date:** [April 20, 2009, 4:42pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853/7 "2009-04-20T16:42:04Z")

</div>

> 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](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.  
> [eigenclass.org](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

---

<div class="post-metadata">

**Author:** ![snaury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@snaury](https://www.ruby-forum.com/u/snaury)\
**Post date:** [April 19, 2009, 5:02am UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853/8 "2009-04-19T05:02:08Z")

</div>

> 1. 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 S. 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

---

<div class="post-metadata">

**Author:** ![snaury](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/77aa72/32.png) [@snaury](https://www.ruby-forum.com/u/snaury)\
**Post date:** [May 9, 2009, 11:39pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-and-mingw-on-windows/165853/9 "2009-05-09T23:39:33Z")

</div>

> 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](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
