* [ruby-core:91731] [Ruby trunk Bug#15650] Segmentation fault when accessing $! in at_exit within a forked process
[not found] <redmine.issue-15650.20190309221037@ruby-lang.org>
@ 2019-03-09 22:11 ` buszkiewiczm
2019-03-11 7:03 ` [ruby-core:91762] " naruse
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: buszkiewiczm @ 2019-03-09 22:11 UTC (permalink / raw)
To: ruby-core
Issue #15650 has been reported by vincentvanbush (Michał Buszkiewicz).
----------------------------------------
Bug #15650: Segmentation fault when accessing $! in at_exit within a forked process
https://bugs.ruby-lang.org/issues/15650
* Author: vincentvanbush (Michał Buszkiewicz)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
In the following piece of code, `break` is erroneously used inside a block passed to `Process.fork`, which would normally result in a ``fork': unexpected break` message.
It is not entirely clear to me whether this should be accessible as an exception object or not - if not, I would expect this code to just print the error out and terminate, so $! would just contain `nil` in the `at_exit` block.
```
fork do
at_exit do
puts $!
end
break
end
```
However, what occurs is a segmentation fault, which can be found in an attachment to this issue.
Historical behavior:
* `ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]`:
```
nil
foo.rb:7:in `fork': unexpected break
```
* `ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]`:
```
foo.rb:3:in `block (2 levels) in <main>': method `method_missing' called on unexpected T_NODE object (0x0055a2323cfc88 flags=0x381c klass=0x0) (NotImplementedError)
from foo.rb:1:in `fork'
from foo.rb:1:in `<main>'
foo.rb:1:in `fork': unexpected break
```
* `ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]`:
foo.rb:3:in `block (2 levels) in <main>': undefined method `inspect' for #<Object:0x005648577df7f8> (NoMethodError)
from foo.rb:1:in `fork'
from foo.rb:1:in `<main>'
foo.rb:1: unexpected break
* `ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]` - segmentation fault
* `ruby 2.2.10p489 (2018-03-28 revision 63023) [x86_64-linux]` - ditto
* `ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]` - ditto
* `ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-linux]` - ditto
* `ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]` - ditto
There is clearly something funny going on since 1.9, and 2.1 goes totally nuts.
When `break` is replaced with `raise 'foo'`, all of these versions catch the exception under `$!` correctly.
Tried compiling 2.6.1 under Ubuntu with GCC 4, 5, 6, 7 and 8, and Clang and the exception is not different. Also tried one of the rubies (2.3.8) compiled in CentOS 7 - no difference in result.
---Files--------------------------------
backtrace.txt (17.3 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:91762] [Ruby trunk Bug#15650] Segmentation fault when accessing $! in at_exit within a forked process
[not found] <redmine.issue-15650.20190309221037@ruby-lang.org>
2019-03-09 22:11 ` [ruby-core:91731] [Ruby trunk Bug#15650] Segmentation fault when accessing $! in at_exit within a forked process buszkiewiczm
@ 2019-03-11 7:03 ` naruse
2019-03-12 21:06 ` [ruby-core:91792] " nagachika00
2019-03-31 15:01 ` [ruby-core:92065] " usa
3 siblings, 0 replies; 4+ messages in thread
From: naruse @ 2019-03-11 7:03 UTC (permalink / raw)
To: ruby-core
Issue #15650 has been updated by naruse (Yui NARUSE).
Backport changed from 2.4: REQUIRED, 2.5: REQUIRED, 2.6: REQUIRED to 2.4: REQUIRED, 2.5: REQUIRED, 2.6: DONE
ruby_2_6 r67209 merged revision(s) 67201.
----------------------------------------
Bug #15650: Segmentation fault when accessing $! in at_exit within a forked process
https://bugs.ruby-lang.org/issues/15650#change-77037
* Author: vincentvanbush (Michał Buszkiewicz)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]
* Backport: 2.4: REQUIRED, 2.5: REQUIRED, 2.6: DONE
----------------------------------------
In the following piece of code, `break` is erroneously used inside a block passed to `Process.fork`, which would normally result in a ``fork': unexpected break` message.
It is not entirely clear to me whether this should be accessible as an exception object or not - if not, I would expect this code to just print the error out and terminate, so $! would just contain `nil` in the `at_exit` block.
```ruby
fork do
at_exit do
puts $!
end
break
end
```
However, what occurs is a segmentation fault, which can be found in an attachment to this issue.
Historical behavior:
* `ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]`:
```
nil
foo.rb:7:in `fork': unexpected break
```
* `ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]`:
```
foo.rb:3:in `block (2 levels) in <main>': method `method_missing' called on unexpected T_NODE object (0x0055a2323cfc88 flags=0x381c klass=0x0) (NotImplementedError)
from foo.rb:1:in `fork'
from foo.rb:1:in `<main>'
foo.rb:1:in `fork': unexpected break
```
* `ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]`:
```
foo.rb:3:in `puts': method `to_ary' called on unexpected T_NODE object (0x00565176a0f820 flags=0x391c) (NotImplementedError)
from foo.rb:3:in `puts'
from foo.rb:3:in `block (2 levels) in <main>'
from foo.rb:1:in `fork'
from foo.rb:1:in `<main>'
foo.rb:1: unexpected break
```
* `ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]` - segmentation fault
* `ruby 2.2.10p489 (2018-03-28 revision 63023) [x86_64-linux]` - ditto
* `ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]` - ditto
* `ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-linux]` - ditto
* `ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]` - ditto
There is clearly something funny going on since 1.9, and 2.1 goes totally nuts.
When `break` is replaced with `raise 'foo'`, all of these versions catch the exception under `$!` correctly.
Tried compiling 2.6.1 under Ubuntu with GCC 4, 5, 6, 7 and 8, and Clang and the exception is not different. Also tried one of the rubies (2.3.8) compiled in CentOS 7 - no difference in result.
---Files--------------------------------
backtrace.txt (17.3 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:91792] [Ruby trunk Bug#15650] Segmentation fault when accessing $! in at_exit within a forked process
[not found] <redmine.issue-15650.20190309221037@ruby-lang.org>
2019-03-09 22:11 ` [ruby-core:91731] [Ruby trunk Bug#15650] Segmentation fault when accessing $! in at_exit within a forked process buszkiewiczm
2019-03-11 7:03 ` [ruby-core:91762] " naruse
@ 2019-03-12 21:06 ` nagachika00
2019-03-31 15:01 ` [ruby-core:92065] " usa
3 siblings, 0 replies; 4+ messages in thread
From: nagachika00 @ 2019-03-12 21:06 UTC (permalink / raw)
To: ruby-core
Issue #15650 has been updated by nagachika (Tomoyuki Chikanaga).
Backport changed from 2.4: REQUIRED, 2.5: REQUIRED, 2.6: DONE to 2.4: REQUIRED, 2.5: DONE, 2.6: DONE
ruby_2_5 r67233 merged revision(s) 67201.
----------------------------------------
Bug #15650: Segmentation fault when accessing $! in at_exit within a forked process
https://bugs.ruby-lang.org/issues/15650#change-77066
* Author: vincentvanbush (Michał Buszkiewicz)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]
* Backport: 2.4: REQUIRED, 2.5: DONE, 2.6: DONE
----------------------------------------
In the following piece of code, `break` is erroneously used inside a block passed to `Process.fork`, which would normally result in a ``fork': unexpected break` message.
It is not entirely clear to me whether this should be accessible as an exception object or not - if not, I would expect this code to just print the error out and terminate, so $! would just contain `nil` in the `at_exit` block.
```ruby
fork do
at_exit do
puts $!
end
break
end
```
However, what occurs is a segmentation fault, which can be found in an attachment to this issue.
Historical behavior:
* `ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]`:
```
nil
foo.rb:7:in `fork': unexpected break
```
* `ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]`:
```
foo.rb:3:in `block (2 levels) in <main>': method `method_missing' called on unexpected T_NODE object (0x0055a2323cfc88 flags=0x381c klass=0x0) (NotImplementedError)
from foo.rb:1:in `fork'
from foo.rb:1:in `<main>'
foo.rb:1:in `fork': unexpected break
```
* `ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]`:
```
foo.rb:3:in `puts': method `to_ary' called on unexpected T_NODE object (0x00565176a0f820 flags=0x391c) (NotImplementedError)
from foo.rb:3:in `puts'
from foo.rb:3:in `block (2 levels) in <main>'
from foo.rb:1:in `fork'
from foo.rb:1:in `<main>'
foo.rb:1: unexpected break
```
* `ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]` - segmentation fault
* `ruby 2.2.10p489 (2018-03-28 revision 63023) [x86_64-linux]` - ditto
* `ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]` - ditto
* `ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-linux]` - ditto
* `ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]` - ditto
There is clearly something funny going on since 1.9, and 2.1 goes totally nuts.
When `break` is replaced with `raise 'foo'`, all of these versions catch the exception under `$!` correctly.
Tried compiling 2.6.1 under Ubuntu with GCC 4, 5, 6, 7 and 8, and Clang and the exception is not different. Also tried one of the rubies (2.3.8) compiled in CentOS 7 - no difference in result.
---Files--------------------------------
backtrace.txt (17.3 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:92065] [Ruby trunk Bug#15650] Segmentation fault when accessing $! in at_exit within a forked process
[not found] <redmine.issue-15650.20190309221037@ruby-lang.org>
` (2 preceding siblings ...)
2019-03-12 21:06 ` [ruby-core:91792] " nagachika00
@ 2019-03-31 15:01 ` usa
3 siblings, 0 replies; 4+ messages in thread
From: usa @ 2019-03-31 15:01 UTC (permalink / raw)
To: ruby-core
Issue #15650 has been updated by usa (Usaku NAKAMURA).
Backport changed from 2.4: REQUIRED, 2.5: DONE, 2.6: DONE to 2.4: DONE, 2.5: DONE, 2.6: DONE
ruby_2_4 r67392 merged revision(s) 67201.
----------------------------------------
Bug #15650: Segmentation fault when accessing $! in at_exit within a forked process
https://bugs.ruby-lang.org/issues/15650#change-77390
* Author: vincentvanbush (Michał Buszkiewicz)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-linux]
* Backport: 2.4: DONE, 2.5: DONE, 2.6: DONE
----------------------------------------
In the following piece of code, `break` is erroneously used inside a block passed to `Process.fork`, which would normally result in a ``fork': unexpected break` message.
It is not entirely clear to me whether this should be accessible as an exception object or not - if not, I would expect this code to just print the error out and terminate, so $! would just contain `nil` in the `at_exit` block.
```ruby
fork do
at_exit do
puts $!
end
break
end
```
However, what occurs is a segmentation fault, which can be found in an attachment to this issue.
Historical behavior:
* `ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]`:
```
nil
foo.rb:7:in `fork': unexpected break
```
* `ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]`:
```
foo.rb:3:in `block (2 levels) in <main>': method `method_missing' called on unexpected T_NODE object (0x0055a2323cfc88 flags=0x381c klass=0x0) (NotImplementedError)
from foo.rb:1:in `fork'
from foo.rb:1:in `<main>'
foo.rb:1:in `fork': unexpected break
```
* `ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]`:
```
foo.rb:3:in `puts': method `to_ary' called on unexpected T_NODE object (0x00565176a0f820 flags=0x391c) (NotImplementedError)
from foo.rb:3:in `puts'
from foo.rb:3:in `block (2 levels) in <main>'
from foo.rb:1:in `fork'
from foo.rb:1:in `<main>'
foo.rb:1: unexpected break
```
* `ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]` - segmentation fault
* `ruby 2.2.10p489 (2018-03-28 revision 63023) [x86_64-linux]` - ditto
* `ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]` - ditto
* `ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-linux]` - ditto
* `ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]` - ditto
There is clearly something funny going on since 1.9, and 2.1 goes totally nuts.
When `break` is replaced with `raise 'foo'`, all of these versions catch the exception under `$!` correctly.
Tried compiling 2.6.1 under Ubuntu with GCC 4, 5, 6, 7 and 8, and Clang and the exception is not different. Also tried one of the rubies (2.3.8) compiled in CentOS 7 - no difference in result.
---Files--------------------------------
backtrace.txt (17.3 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread