Project

General

Profile

Actions

Bug #11166

closed

thread becames broken after unsuccessful system() or Process.spawn() call

Added by cvss (Kirill Vechera) almost 9 years ago. Updated almost 9 years ago.

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

Description

After calling system() or Process.spawn() with non-existing command the thread works incorrectly:

  • doesn't response to thread kill
  • hangs forever in condition wait or mutexes

The least leads to hanging in file write() or puts() calls due wrong mutex handling or to "No live threads left. Deadlock? (fatal)"

The minimal reproducible script which shows if the thread becames unkillable:

require 'thread'

1000000.times do |i|
	puts "loop: #{i}"
	t = Thread.new {
		system('/nonexistent')
		puts "done"
		sleep
	}

	sleep 0.000001

	t.kill
	t.join
	# hang up forever on join if thread can't respond to kill
end

Files

2.rb (223 Bytes) 2.rb cvss (Kirill Vechera), 05/21/2015 04:44 PM
Actions #1

Updated by cvss (Kirill Vechera) almost 9 years ago

  • Assignee deleted (core)
  • ruby -v set to 2.2.0
Actions #2

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

  • Status changed from Open to Closed

Applied in changeset r50600.


process.c: do not discard status

  • process.c (rb_spawn_process): do not discard global escape
    status. [ruby-core:69304] [Bug #11166]
  • process.c (rb_execarg_spawn): extract the start procedure in a
    parent process with ensuring the end procedure.

Updated by nagachika (Tomoyuki Chikanaga) almost 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: REQUIRED

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

Seems same behavior since 1.9.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0