ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:37454] [Ruby 1.9 - Bug #4347][Assigned] Tracing cannot be re-enabled after callcc [patch]
       [not found] <redmine.issue-4347.20110131053243@ruby-lang.org>
@ 2011-06-26  8:29 ` Yui NARUSE
  2011-06-26 14:28 ` [ruby-core:37529] [Ruby 1.9 - Bug #4347] " Hiroshi Nakamura
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Yui NARUSE @ 2011-06-26  8:29 UTC (permalink / raw
  To: ruby-core


Issue #4347 has been updated by Yui NARUSE.

Status changed from Open to Assigned
Assignee set to Koichi Sasada


----------------------------------------
Bug #4347: Tracing cannot be re-enabled after callcc [patch]
http://redmine.ruby-lang.org/issues/4347

Author: James M. Lawrence
Status: Assigned
Priority: Normal
Assignee: Koichi Sasada
Category: core
Target version: 1.9.x
ruby -v: ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]


=begin
 % patch -p1 < test_continuation_tracing.patch 
 patching file test/ruby/test_continuation.rb
 % ./ruby -v test/ruby/test_continuation.rb 
 ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]
 Run options: 
 
 # Running tests:
 
 ......FF
 
 Finished tests in 0.080788s, 99.0246 tests/s, 148.5369 assertions/s.
 
   1) Failure:
 test_tracing_with_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:99]:
 <3> expected but was
 <1>.
 
   2) Failure:
 test_tracing_with_thread_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:121]:
 <3> expected but was
 <0>.
 
 In thread.c (thread_suppress_tracing) the code after (*func)(arg, running)
 is not executed, causing th->tracing to not be cleared.
 
 This two-line patch works, though it may only address a symptom.
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:37529] [Ruby 1.9 - Bug #4347] Tracing cannot be re-enabled after callcc [patch]
       [not found] <redmine.issue-4347.20110131053243@ruby-lang.org>
  2011-06-26  8:29 ` [ruby-core:37454] [Ruby 1.9 - Bug #4347][Assigned] Tracing cannot be re-enabled after callcc [patch] Yui NARUSE
@ 2011-06-26 14:28 ` Hiroshi Nakamura
  2011-07-10 18:13 ` [ruby-core:37970] " Yusuke Endoh
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Hiroshi Nakamura @ 2011-06-26 14:28 UTC (permalink / raw
  To: ruby-core


Issue #4347 has been updated by Hiroshi Nakamura.

Target version changed from 1.9.x to 1.9.3


----------------------------------------
Bug #4347: Tracing cannot be re-enabled after callcc [patch]
http://redmine.ruby-lang.org/issues/4347

Author: James M. Lawrence
Status: Assigned
Priority: Normal
Assignee: Koichi Sasada
Category: core
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]


=begin
 % patch -p1 < test_continuation_tracing.patch 
 patching file test/ruby/test_continuation.rb
 % ./ruby -v test/ruby/test_continuation.rb 
 ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]
 Run options: 
 
 # Running tests:
 
 ......FF
 
 Finished tests in 0.080788s, 99.0246 tests/s, 148.5369 assertions/s.
 
   1) Failure:
 test_tracing_with_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:99]:
 <3> expected but was
 <1>.
 
   2) Failure:
 test_tracing_with_thread_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:121]:
 <3> expected but was
 <0>.
 
 In thread.c (thread_suppress_tracing) the code after (*func)(arg, running)
 is not executed, causing th->tracing to not be cleared.
 
 This two-line patch works, though it may only address a symptom.
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:37970] [Ruby 1.9 - Bug #4347] Tracing cannot be re-enabled after callcc [patch]
       [not found] <redmine.issue-4347.20110131053243@ruby-lang.org>
  2011-06-26  8:29 ` [ruby-core:37454] [Ruby 1.9 - Bug #4347][Assigned] Tracing cannot be re-enabled after callcc [patch] Yui NARUSE
  2011-06-26 14:28 ` [ruby-core:37529] [Ruby 1.9 - Bug #4347] " Hiroshi Nakamura
@ 2011-07-10 18:13 ` Yusuke Endoh
  2011-07-10 18:45   ` [ruby-core:37972] " Magnus Holm
  2011-07-21  5:38 ` [ruby-core:38308] [Ruby 1.9 - Feature " Motohiro KOSAKI
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 9+ messages in thread
From: Yusuke Endoh @ 2011-07-10 18:13 UTC (permalink / raw
  To: ruby-core


Issue #4347 has been updated by Yusuke Endoh.

Assignee changed from Koichi Sasada to Yusuke Endoh

Hello,

2011/1/31 James M. Lawrence <redmine@ruby-lang.org>:
> In thread.c (thread_suppress_tracing) the code after (*func)(arg, running)
> is not executed, causing th->tracing to not be cleared.
>
> This two-line patch works, though it may only address a symptom.


Thank you for your reporting and providing patch.


The root cause of this issue is that Continuation#call ignores
ensure clause:

  callcc do |c|
    begin
      c.call
    ensure
      p :foo
    end
  end  #=> nothing output


When Continuation#call is executed in the proc of set_trace_func,
it skips the post-processing of set_trace_func, resulting in
corrupt state of rb_thread_t#tracing.

Your patch forces to reset the state when set_trace_func(nil). But
to address this issue fundamentally, Continuation#call must call
current ensure clauses.  It needs very hard work, though.


As you know, your patch is not essintial fix, but it works actually
in your example, and looks benign.  So I'll import it.

But note that there is still other issues, and that this issue may
have a relapse in future.  If you want not to hit a land mine, do
not use callcc seriously.  It is very fun, joke feature, I think.


Thanks,

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Bug #4347: Tracing cannot be re-enabled after callcc [patch]
http://redmine.ruby-lang.org/issues/4347

Author: James M. Lawrence
Status: Assigned
Priority: Normal
Assignee: Yusuke Endoh
Category: core
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]


=begin
 % patch -p1 < test_continuation_tracing.patch 
 patching file test/ruby/test_continuation.rb
 % ./ruby -v test/ruby/test_continuation.rb 
 ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]
 Run options: 
 
 # Running tests:
 
 ......FF
 
 Finished tests in 0.080788s, 99.0246 tests/s, 148.5369 assertions/s.
 
   1) Failure:
 test_tracing_with_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:99]:
 <3> expected but was
 <1>.
 
   2) Failure:
 test_tracing_with_thread_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:121]:
 <3> expected but was
 <0>.
 
 In thread.c (thread_suppress_tracing) the code after (*func)(arg, running)
 is not executed, causing th->tracing to not be cleared.
 
 This two-line patch works, though it may only address a symptom.
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:37972] Re: [Ruby 1.9 - Bug #4347] Tracing cannot be re-enabled after callcc [patch]
  2011-07-10 18:13 ` [ruby-core:37970] " Yusuke Endoh
@ 2011-07-10 18:45   ` Magnus Holm
  0 siblings, 0 replies; 9+ messages in thread
From: Magnus Holm @ 2011-07-10 18:45 UTC (permalink / raw
  To: ruby-core

> But note that there is still other issues, and that this issue may
> have a relapse in future.  If you want not to hit a land mine, do
> not use callcc seriously.  It is very fun, joke feature, I think.

Gotos are a joke feature too… Any chance we can get them in a separate
library like callcc too? :D

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:38308] [Ruby 1.9 - Feature #4347] Tracing cannot be re-enabled after callcc [patch]
       [not found] <redmine.issue-4347.20110131053243@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2011-07-10 18:13 ` [ruby-core:37970] " Yusuke Endoh
@ 2011-07-21  5:38 ` Motohiro KOSAKI
  2011-07-21 11:20 ` [ruby-core:38326] [Ruby 1.9 - Feature #4347][Assigned] " Yusuke Endoh
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Motohiro KOSAKI @ 2011-07-21  5:38 UTC (permalink / raw
  To: ruby-core


Issue #4347 has been updated by Motohiro KOSAKI.

Target version changed from 1.9.3 to 1.9.x


----------------------------------------
Feature #4347: Tracing cannot be re-enabled after callcc [patch]
http://redmine.ruby-lang.org/issues/4347

Author: James M. Lawrence
Status: Assigned
Priority: Normal
Assignee: Yusuke Endoh
Category: core
Target version: 1.9.x


=begin
 % patch -p1 < test_continuation_tracing.patch 
 patching file test/ruby/test_continuation.rb
 % ./ruby -v test/ruby/test_continuation.rb 
 ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]
 Run options: 
 
 # Running tests:
 
 ......FF
 
 Finished tests in 0.080788s, 99.0246 tests/s, 148.5369 assertions/s.
 
   1) Failure:
 test_tracing_with_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:99]:
 <3> expected but was
 <1>.
 
   2) Failure:
 test_tracing_with_thread_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:121]:
 <3> expected but was
 <0>.
 
 In thread.c (thread_suppress_tracing) the code after (*func)(arg, running)
 is not executed, causing th->tracing to not be cleared.
 
 This two-line patch works, though it may only address a symptom.
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:38326] [Ruby 1.9 - Feature #4347][Assigned] Tracing cannot be re-enabled after callcc [patch]
       [not found] <redmine.issue-4347.20110131053243@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2011-07-21  5:38 ` [ruby-core:38308] [Ruby 1.9 - Feature " Motohiro KOSAKI
@ 2011-07-21 11:20 ` Yusuke Endoh
  2011-07-21 11:43 ` [ruby-core:38328] [Ruby 1.9 - Feature #4347] " Motohiro KOSAKI
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Yusuke Endoh @ 2011-07-21 11:20 UTC (permalink / raw
  To: ruby-core


Issue #4347 has been updated by Yusuke Endoh.

Status changed from Closed to Assigned
Assignee changed from Yusuke Endoh to Motohiro KOSAKI

Hello,

@James
Sorry, I didn't make the deadline to import your patch.
Kosaki, who is the "virtual" release manager, changed this ticket to
1.9.x feature.
I've just imported it to trunk.  It is up to a release manager to
decide whether this is imported to 1.9.3 or not.

@Magnus
If anyone write a patch. :-)

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Feature #4347: Tracing cannot be re-enabled after callcc [patch]
http://redmine.ruby-lang.org/issues/4347

Author: James M. Lawrence
Status: Assigned
Priority: Normal
Assignee: Motohiro KOSAKI
Category: core
Target version: 1.9.x


=begin
 % patch -p1 < test_continuation_tracing.patch 
 patching file test/ruby/test_continuation.rb
 % ./ruby -v test/ruby/test_continuation.rb 
 ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]
 Run options: 
 
 # Running tests:
 
 ......FF
 
 Finished tests in 0.080788s, 99.0246 tests/s, 148.5369 assertions/s.
 
   1) Failure:
 test_tracing_with_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:99]:
 <3> expected but was
 <1>.
 
   2) Failure:
 test_tracing_with_thread_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:121]:
 <3> expected but was
 <0>.
 
 In thread.c (thread_suppress_tracing) the code after (*func)(arg, running)
 is not executed, causing th->tracing to not be cleared.
 
 This two-line patch works, though it may only address a symptom.
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:38328] [Ruby 1.9 - Feature #4347] Tracing cannot be re-enabled after callcc [patch]
       [not found] <redmine.issue-4347.20110131053243@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2011-07-21 11:20 ` [ruby-core:38326] [Ruby 1.9 - Feature #4347][Assigned] " Yusuke Endoh
@ 2011-07-21 11:43 ` Motohiro KOSAKI
  2011-07-21 12:13 ` [ruby-core:38331] [Ruby 1.9 - Feature #4347][Closed] " Yusuke Endoh
  2012-08-16  2:34 ` [ruby-core:47220] [ruby-trunk - Feature #4347][Assigned] " ko1 (Koichi Sasada)
  7 siblings, 0 replies; 9+ messages in thread
From: Motohiro KOSAKI @ 2011-07-21 11:43 UTC (permalink / raw
  To: ruby-core


Issue #4347 has been updated by Motohiro KOSAKI.

Assignee changed from Motohiro KOSAKI to Yusuke Endoh

> @James
> Sorry, I didn't make the deadline to import your patch.
> Kosaki, who is the "virtual" release manager, changed this ticket to
> 1.9.x feature.
> I've just imported it to trunk.  It is up to a release manager to
> decide whether this is imported to 1.9.3 or not.

Of course, I'd respect your decision. Please commit it to ruby_1_9_3 branch. ;-)

----------------------------------------
Feature #4347: Tracing cannot be re-enabled after callcc [patch]
http://redmine.ruby-lang.org/issues/4347

Author: James M. Lawrence
Status: Assigned
Priority: Normal
Assignee: Yusuke Endoh
Category: core
Target version: 1.9.x


=begin
 % patch -p1 < test_continuation_tracing.patch 
 patching file test/ruby/test_continuation.rb
 % ./ruby -v test/ruby/test_continuation.rb 
 ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]
 Run options: 
 
 # Running tests:
 
 ......FF
 
 Finished tests in 0.080788s, 99.0246 tests/s, 148.5369 assertions/s.
 
   1) Failure:
 test_tracing_with_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:99]:
 <3> expected but was
 <1>.
 
   2) Failure:
 test_tracing_with_thread_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:121]:
 <3> expected but was
 <0>.
 
 In thread.c (thread_suppress_tracing) the code after (*func)(arg, running)
 is not executed, causing th->tracing to not be cleared.
 
 This two-line patch works, though it may only address a symptom.
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:38331] [Ruby 1.9 - Feature #4347][Closed] Tracing cannot be re-enabled after callcc [patch]
       [not found] <redmine.issue-4347.20110131053243@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2011-07-21 11:43 ` [ruby-core:38328] [Ruby 1.9 - Feature #4347] " Motohiro KOSAKI
@ 2011-07-21 12:13 ` Yusuke Endoh
  2012-08-16  2:34 ` [ruby-core:47220] [ruby-trunk - Feature #4347][Assigned] " ko1 (Koichi Sasada)
  7 siblings, 0 replies; 9+ messages in thread
From: Yusuke Endoh @ 2011-07-21 12:13 UTC (permalink / raw
  To: ruby-core


Issue #4347 has been updated by Yusuke Endoh.

Status changed from Assigned to Closed

Done.  Thank you very much!

-- 
Yusuke Endoh <mame@tsg.ne.jp>
----------------------------------------
Feature #4347: Tracing cannot be re-enabled after callcc [patch]
http://redmine.ruby-lang.org/issues/4347

Author: James M. Lawrence
Status: Closed
Priority: Normal
Assignee: Yusuke Endoh
Category: core
Target version: 1.9.x


=begin
 % patch -p1 < test_continuation_tracing.patch 
 patching file test/ruby/test_continuation.rb
 % ./ruby -v test/ruby/test_continuation.rb 
 ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]
 Run options: 
 
 # Running tests:
 
 ......FF
 
 Finished tests in 0.080788s, 99.0246 tests/s, 148.5369 assertions/s.
 
   1) Failure:
 test_tracing_with_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:99]:
 <3> expected but was
 <1>.
 
   2) Failure:
 test_tracing_with_thread_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:121]:
 <3> expected but was
 <0>.
 
 In thread.c (thread_suppress_tracing) the code after (*func)(arg, running)
 is not executed, causing th->tracing to not be cleared.
 
 This two-line patch works, though it may only address a symptom.
=end



-- 
http://redmine.ruby-lang.org

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ruby-core:47220] [ruby-trunk - Feature #4347][Assigned] Tracing cannot be re-enabled after callcc [patch]
       [not found] <redmine.issue-4347.20110131053243@ruby-lang.org>
                   ` (6 preceding siblings ...)
  2011-07-21 12:13 ` [ruby-core:38331] [Ruby 1.9 - Feature #4347][Closed] " Yusuke Endoh
@ 2012-08-16  2:34 ` ko1 (Koichi Sasada)
  7 siblings, 0 replies; 9+ messages in thread
From: ko1 (Koichi Sasada) @ 2012-08-16  2:34 UTC (permalink / raw
  To: ruby-core


Issue #4347 has been updated by ko1 (Koichi Sasada).

Status changed from Closed to Assigned
Assignee changed from mame (Yusuke Endoh) to ko1 (Koichi Sasada)

I reopen this ticket.  As you say, this is only workaround.

I solve this problem with restoring 'tracing state' (running trace func or not) at Continuation#call.  I believe it is not a work around, but essential solution.  I revert your proposal and set_trace_func(nil) does not clear tracing state any more.

With this change, your test code go to infinite loop:

# example code
require 'continuation'
 
cont = nil
 
func = lambda{|*args|
  p [1, args]
  cont.call(nil)
}
 
3.times{
  cont = callcc{|c| c}
  # -> (1) call trace func (c-return), (2) call cont.call(nil) and come here!

  p cont
   
  if cont
    set_trace_func(func)
  else
    set_trace_func(nil)
  end
}


With my patch, this example work fine:

require 'continuation'
 
cont = nil
func = lambda{|*args|
  p [1, args]
  cont, c = nil, cont
  c.call(nil) if c
}

3.times{|i|
  p i
  cont = callcc{|c| c}
  p cont

  if cont
    set_trace_func(func)
  end
}


I quote mame-san's comment, again.

> But note that there is still other issues, and that this issue may have a relapse in future. If you want not to hit a land mine, do not use callcc seriously. It is very fun, joke feature, I think.

----------------------------------------
Feature #4347: Tracing cannot be re-enabled after callcc [patch]
https://bugs.ruby-lang.org/issues/4347#change-28902

Author: quix (James M. Lawrence)
Status: Assigned
Priority: Normal
Assignee: ko1 (Koichi Sasada)
Category: core
Target version: 2.0.0


=begin
 % patch -p1 < test_continuation_tracing.patch 
 patching file test/ruby/test_continuation.rb
 % ./ruby -v test/ruby/test_continuation.rb 
 ruby 1.9.3dev (2011-01-30 trunk 30735) [i386-darwin9.8.0]
 Run options: 
 
 # Running tests:
 
 ......FF
 
 Finished tests in 0.080788s, 99.0246 tests/s, 148.5369 assertions/s.
 
   1) Failure:
 test_tracing_with_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:99]:
 <3> expected but was
 <1>.
 
   2) Failure:
 test_tracing_with_thread_set_trace_func(TestContinuation) [test/ruby/test_continuation.rb:121]:
 <3> expected but was
 <0>.
 
 In thread.c (thread_suppress_tracing) the code after (*func)(arg, running)
 is not executed, causing th->tracing to not be cleared.
 
 This two-line patch works, though it may only address a symptom.
=end



-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-08-16  2:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-4347.20110131053243@ruby-lang.org>
2011-06-26  8:29 ` [ruby-core:37454] [Ruby 1.9 - Bug #4347][Assigned] Tracing cannot be re-enabled after callcc [patch] Yui NARUSE
2011-06-26 14:28 ` [ruby-core:37529] [Ruby 1.9 - Bug #4347] " Hiroshi Nakamura
2011-07-10 18:13 ` [ruby-core:37970] " Yusuke Endoh
2011-07-10 18:45   ` [ruby-core:37972] " Magnus Holm
2011-07-21  5:38 ` [ruby-core:38308] [Ruby 1.9 - Feature " Motohiro KOSAKI
2011-07-21 11:20 ` [ruby-core:38326] [Ruby 1.9 - Feature #4347][Assigned] " Yusuke Endoh
2011-07-21 11:43 ` [ruby-core:38328] [Ruby 1.9 - Feature #4347] " Motohiro KOSAKI
2011-07-21 12:13 ` [ruby-core:38331] [Ruby 1.9 - Feature #4347][Closed] " Yusuke Endoh
2012-08-16  2:34 ` [ruby-core:47220] [ruby-trunk - Feature #4347][Assigned] " ko1 (Koichi Sasada)

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 read-only IMAP folder(s) and NNTP newsgroup(s).