Project

General

Profile

Actions

Bug #11482

closed

Multiple versions of Ruby crashing with simple threaded client/server test

Added by s_p_oneil (Sean O'Neil) about 9 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

Description

Using the attached client and server scripts, I have been able to quickly crash every version of Ruby I tested from 1.9.3 to 2.2.3. Sometimes only the client crashes, sometimes only the server, and a few times I've seen both crash at the same time. Sometimes it has to run a while before either crashes, but it usually happens pretty quickly.

I've only tested it on Windows (built with multiple compilers), but it may happen on other operating systems as well. I have tested:

  • v1.9.3-p374 built with Visual Studio 2012 (x86 and x64)
  • v2.1.5 built with Visual Studio 2012 and 2015 (x86 and x64)
  • v2.1.7 built with Visual Studio 2012 and 2015 (x86 and x64)
  • v2.2.2 built with Visual Studio 2012 and 2015 (x86 and x64)
  • v2.2.3 built with Visual Studio 2012 and 2015 (x86 and x64)
  • The RubyInstaller v2.2.2 (x64-mingw32)
  • The current ruby_2_2 branch built with Visual Studio 2015 (x86 and x64)

vs2015.patch: I applied this patch to the 2.x versions to get it compiling and running in Visual Studio 2015. This patch is a combination of other patches I've seen online, and it has worked well so far (aside from the crashes that seem to be occurring when built with other compilers as well).

The crash dump always seems to point to gc.c or st.c. It's hard to see what's causing it in gc.c in Visual Studio, but when it crashes in st.c, it is usually due to st_table_entry::next and st_table_entry::prev being set to an invalid non-NULL value (so far it always appears to be set to 0x1 or 0x32, which can cause it to crash in various places in st.c, but I haven't figured out where/how they're being set to those values).

The only reason I tried so many different versions is because I was hoping to find one that worked to choose as a "stable" version to use, but in the end I had to give up and submit this problem to the experts.


Files

client.rb (540 Bytes) client.rb s_p_oneil (Sean O'Neil), 08/24/2015 03:21 PM
server.rb (588 Bytes) server.rb s_p_oneil (Sean O'Neil), 08/24/2015 03:21 PM
vs2015.patch (7.44 KB) vs2015.patch s_p_oneil (Sean O'Neil), 08/24/2015 03:25 PM

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

  • Status changed from Open to Closed

I wasn't able to get Ruby to crash with this (maybe I didn't wait long enough?). I tried multiple Ruby versions, all using RubyInstaller:

Ruby 2.1: 21925 successes, 175 failures
Ruby 2.2: 20252 successes, 148 failures
Ruby 2.3: 29900 successes, 0 failures
Ruby 2.4: 9265 successes, 635 failures*
Ruby 2.5: 24200 successes, 0 failures
Ruby 2.6: 29400 successes, 0 failures

Ruby 2.4 server output showed:

[2019-07-23 11:51:13] ERROR Errno::EBADF: Bad file descriptor - not a socket file descriptor
        C:/Ruby24-x64/lib/ruby/2.4.0/webrick/server.rb:257:in `accept'

And after that it looked like the client continually failed.

Anyway, it appears that this issue has been addressed in recent versions.

Actions

Also available in: Atom PDF

Like0
Like0