* [ruby-core:119649] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution
@ 2024-10-31 8:30 hurricup (Alexandr Evstigneev) via ruby-core
2024-10-31 19:56 ` [ruby-core:119660] " Eregon (Benoit Daloze) via ruby-core
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: hurricup (Alexandr Evstigneev) via ruby-core @ 2024-10-31 8:30 UTC (permalink / raw)
To: ruby-core; +Cc: hurricup (Alexandr Evstigneev)
Issue #20856 has been reported by hurricup (Alexandr Evstigneev).
----------------------------------------
Bug #20856: Incorrect and inconsistent multi-thread eval execution
https://bugs.ruby-lang.org/issues/20856
* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* ruby -v: 3.4.0-preview2
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Consider example:
```
s = Thread.new {
a = 5
puts eval("a == b")
x = 6
}
s.join
b = 11
```
As far as I see it, it should not work. Because at the moment of eval, b is unknown and not even declared (it can even be in condition).
But it may be available because file `iseq` already compiled and we know that there is b.
So, this works in ruby 3.3 in a script we running, wrapped into the method, or required by other file.
But in 3.4-preview2:
- it works in file
- it works in method
- it fails if required from other file with:
```
#<Thread:0x00007725530d6a98 /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:1 run> terminated with exception (report_on_exception is true):
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
```
And this ^^ is correct behavior if you ask me :) but atm it is inconsistent between the ruby versions and even in the scope of 3.4-preview2
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:119660] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution
2024-10-31 8:30 [ruby-core:119649] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution hurricup (Alexandr Evstigneev) via ruby-core
@ 2024-10-31 19:56 ` Eregon (Benoit Daloze) via ruby-core
2024-10-31 19:57 ` [ruby-core:119661] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution with Prism compiler Eregon (Benoit Daloze) via ruby-core
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Eregon (Benoit Daloze) via ruby-core @ 2024-10-31 19:56 UTC (permalink / raw)
To: ruby-core; +Cc: Eregon (Benoit Daloze)
Issue #20856 has been updated by Eregon (Benoit Daloze).
Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED
It's a bug of 3.4.0-preview2 and specifically of the Prism compiler, 3.3 and earlier and `--parser=parse.y` succeed for all cases.
The order is:
* parse that file:
* execute it
* in that new thread eval is called
* that parses `"a == b"`, with outer scopes [[a,x], [s,b]].
----------------------------------------
Bug #20856: Incorrect and inconsistent multi-thread eval execution
https://bugs.ruby-lang.org/issues/20856#change-110317
* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* ruby -v: 3.4.0-preview2
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED
----------------------------------------
Consider example:
```
s = Thread.new {
a = 5
puts eval("a == b")
x = 6
}
s.join
b = 11
```
As far as I see it, it should not work. Because at the moment of eval, b is unknown and not even declared (it can even be in condition).
But it may be available because file `iseq` already compiled and we know that there is b.
So, this works in ruby 3.3 in a script we running, wrapped into the method, or required by other file.
But in 3.4-preview2:
- it works in file
- it works in method
- it fails if required from other file with:
```
#<Thread:0x00007725530d6a98 /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:1 run> terminated with exception (report_on_exception is true):
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
```
And this ^^ is correct behavior if you ask me :) but atm it is inconsistent between the ruby versions and even in the scope of 3.4-preview2
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:119661] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution with Prism compiler
2024-10-31 8:30 [ruby-core:119649] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution hurricup (Alexandr Evstigneev) via ruby-core
2024-10-31 19:56 ` [ruby-core:119660] " Eregon (Benoit Daloze) via ruby-core
@ 2024-10-31 19:57 ` Eregon (Benoit Daloze) via ruby-core
2024-10-31 20:00 ` [ruby-core:119662] " Eregon (Benoit Daloze) via ruby-core
2024-11-04 20:03 ` [ruby-core:119701] " kddnewton (Kevin Newton) via ruby-core
3 siblings, 0 replies; 5+ messages in thread
From: Eregon (Benoit Daloze) via ruby-core @ 2024-10-31 19:57 UTC (permalink / raw)
To: ruby-core; +Cc: Eregon (Benoit Daloze)
Issue #20856 has been updated by Eregon (Benoit Daloze).
Subject changed from Incorrect and inconsistent multi-thread eval execution to Incorrect and inconsistent multi-thread eval execution with Prism compiler
Assignee set to kddnewton (Kevin Newton)
----------------------------------------
Bug #20856: Incorrect and inconsistent multi-thread eval execution with Prism compiler
https://bugs.ruby-lang.org/issues/20856#change-110318
* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* Assignee: kddnewton (Kevin Newton)
* ruby -v: 3.4.0-preview2
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED
----------------------------------------
Consider example:
```
s = Thread.new {
a = 5
puts eval("a == b")
x = 6
}
s.join
b = 11
```
As far as I see it, it should not work. Because at the moment of eval, b is unknown and not even declared (it can even be in condition).
But it may be available because file `iseq` already compiled and we know that there is b.
So, this works in ruby 3.3 in a script we running, wrapped into the method, or required by other file.
But in 3.4-preview2:
- it works in file
- it works in method
- it fails if required from other file with:
```
#<Thread:0x00007725530d6a98 /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:1 run> terminated with exception (report_on_exception is true):
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
```
And this ^^ is correct behavior if you ask me :) but atm it is inconsistent between the ruby versions and even in the scope of 3.4-preview2
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:119662] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution with Prism compiler
2024-10-31 8:30 [ruby-core:119649] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution hurricup (Alexandr Evstigneev) via ruby-core
2024-10-31 19:56 ` [ruby-core:119660] " Eregon (Benoit Daloze) via ruby-core
2024-10-31 19:57 ` [ruby-core:119661] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution with Prism compiler Eregon (Benoit Daloze) via ruby-core
@ 2024-10-31 20:00 ` Eregon (Benoit Daloze) via ruby-core
2024-11-04 20:03 ` [ruby-core:119701] " kddnewton (Kevin Newton) via ruby-core
3 siblings, 0 replies; 5+ messages in thread
From: Eregon (Benoit Daloze) via ruby-core @ 2024-10-31 20:00 UTC (permalink / raw)
To: ruby-core; +Cc: Eregon (Benoit Daloze)
Issue #20856 has been updated by Eregon (Benoit Daloze).
Assignee changed from kddnewton (Kevin Newton) to prism
----------------------------------------
Bug #20856: Incorrect and inconsistent multi-thread eval execution with Prism compiler
https://bugs.ruby-lang.org/issues/20856#change-110319
* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* Assignee: prism
* ruby -v: 3.4.0-preview2
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED
----------------------------------------
Consider example:
```
s = Thread.new {
a = 5
puts eval("a == b")
x = 6
}
s.join
b = 11
```
As far as I see it, it should not work. Because at the moment of eval, b is unknown and not even declared (it can even be in condition).
But it may be available because file `iseq` already compiled and we know that there is b.
So, this works in ruby 3.3 in a script we running, wrapped into the method, or required by other file.
But in 3.4-preview2:
- it works in file
- it works in method
- it fails if required from other file with:
```
#<Thread:0x00007725530d6a98 /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:1 run> terminated with exception (report_on_exception is true):
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
```
And this ^^ is correct behavior if you ask me :) but atm it is inconsistent between the ruby versions and even in the scope of 3.4-preview2
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:119701] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution with Prism compiler
2024-10-31 8:30 [ruby-core:119649] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution hurricup (Alexandr Evstigneev) via ruby-core
` (2 preceding siblings ...)
2024-10-31 20:00 ` [ruby-core:119662] " Eregon (Benoit Daloze) via ruby-core
@ 2024-11-04 20:03 ` kddnewton (Kevin Newton) via ruby-core
3 siblings, 0 replies; 5+ messages in thread
From: kddnewton (Kevin Newton) via ruby-core @ 2024-11-04 20:03 UTC (permalink / raw)
To: ruby-core; +Cc: kddnewton (Kevin Newton)
Issue #20856 has been updated by kddnewton (Kevin Newton).
Thanks for the report, it should be fixed by https://github.com/ruby/ruby/pull/11993.
----------------------------------------
Bug #20856: Incorrect and inconsistent multi-thread eval execution with Prism compiler
https://bugs.ruby-lang.org/issues/20856#change-110361
* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* Assignee: prism
* ruby -v: 3.4.0-preview2
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED
----------------------------------------
Consider example:
```
s = Thread.new {
a = 5
puts eval("a == b")
x = 6
}
s.join
b = 11
```
As far as I see it, it should not work. Because at the moment of eval, b is unknown and not even declared (it can even be in condition).
But it may be available because file `iseq` already compiled and we know that there is b.
So, this works in ruby 3.3 in a script we running, wrapped into the method, or required by other file.
But in 3.4-preview2:
- it works in file
- it works in method
- it fails if required from other file with:
```
#<Thread:0x00007725530d6a98 /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:1 run> terminated with exception (report_on_exception is true):
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
(eval at /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3):1:in 'block in <top (required)>': undefined local variable or method 'b' for main (NameError)
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'Kernel#eval'
from /home/hurricup/Projects/ruby-debugger/rdi30/test2.rb:3:in 'block in <top (required)>'
```
And this ^^ is correct behavior if you ask me :) but atm it is inconsistent between the ruby versions and even in the scope of 3.4-preview2
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-04 20:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-31 8:30 [ruby-core:119649] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution hurricup (Alexandr Evstigneev) via ruby-core
2024-10-31 19:56 ` [ruby-core:119660] " Eregon (Benoit Daloze) via ruby-core
2024-10-31 19:57 ` [ruby-core:119661] [Ruby master Bug#20856] Incorrect and inconsistent multi-thread eval execution with Prism compiler Eregon (Benoit Daloze) via ruby-core
2024-10-31 20:00 ` [ruby-core:119662] " Eregon (Benoit Daloze) via ruby-core
2024-11-04 20:03 ` [ruby-core:119701] " kddnewton (Kevin Newton) via ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).