Project

General

Profile

Bug #11353

ASYNC BUG after failure of Process.exec when closing FD 3 (or 4 or 5)

Added by ngoto (Naohisa Goto) almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:69977]

Description

The following shows ASYNC BUG.

ruby -e 'Process.exec("/does_not_exist", "arg", {3=>:close})'
[ASYNC BUG] -e:1:in `exec': No such file or directory - /does_not_exist (Errno::ENOENT)
    from -e:1:in `<main>'
consume_communication_pipe: read

EBADF

ruby 2.3.0dev (2015-07-10) [x86_64-linux]

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Aborted

Closing FD 4 or 5 also causes ASYNC BUG.


Related issues

Related to Ruby master - Bug #11350: When Process.exec failed, redirections were still changed and not restoredClosedActions
Related to Ruby master - Bug #11336: TestProcess#test_exec_fd_3_redirect failed on Solaris 10ClosedActions
#1

Updated by ngoto (Naohisa Goto) almost 5 years ago

  • Related to Bug #11350: When Process.exec failed, redirections were still changed and not restored added
#2

Updated by ngoto (Naohisa Goto) almost 5 years ago

  • Related to Bug #11336: TestProcess#test_exec_fd_3_redirect failed on Solaris 10 added
#3

Updated by ngoto (Naohisa Goto) almost 5 years ago

  • Status changed from Open to Closed

Applied in changeset r51255.


  • process.c (redirect_close, parent_redirect_close): should not close
    reserved FD. It should be closed in the exec system call due to the
    O_CLOEXEC or FD_CLOEXEC flag. [Bug #11353] [ruby-core:69977]

  • process.c (close_unless_reserved): new function to close FD unless
    it is reserved for internal communication.

  • thread_pthread.c (rb_reserved_fd_p): should check owner_process pid
    to avoid false positive in forked child process.

Also available in: Atom PDF