From: Luis Lavena Date: 2010-04-22T04:00:10+09:00 Subject: Re: Ruby 1.9.1, Threads and "[BUG] The handle is invalid." On Apr 21, 11:39 am, Chuck Remes wrote: > [...] > > > So my question is: Does anybody know how to get rid of this error on > > windows or maybe any workaround and what this error mean? > > You might want to try the release from ruby-lang.org [1]. It is built differently than the version you are running (I assume you got it from rubyinstaller.org). The Ruby from ruby-lang is built using Microsoft's development tools and calls into Win32 APIs directly. The version from rubyinstaller.org is built against MinGW which provides a POSIX emulation layer on top of most Windows APIs. As a result, the mingw version exercises more UNIX code paths than it does Windows code paths in the 1.9.x source. > Your statements are incorrect. You're confusing MinGW with cygwin. MinGW provides minimal set of GNU tools for Windows (that is the meaning of MinGW acronym) It links and compiles against Win32API, there is no emulation layer of POSIX functionality. Please research before state that type of answers as it might confuse and alienate users of Ruby on Windows platform. As for the original reporter of the issue: You're trying to "print" to STDOUT from different threads, which will produce a race conditions and depending other operations you're performing, highly likely will crash. Add to that, you're trying to spawn 700 threads, which spawned quickly will generate overhead and highly likely you're exhausting resources in the process (since you don't get a backtrace of your test script) But more concrete, exhausting of resources could be associated with available descriptors that Ruby 1.9 has been compiled for. -- Luis Lavena