CARVIEW |
Select Language
HTTP/2 200
x-amz-id-2: Y0lvK32VsO+aoA7CVQY8VB7ZCMm/a106H++ATAerBPcnZW6tV/pcGB4FWk7YUK4TcOkp2gX6GZ4=
x-amz-request-id: YMSWSX6X8870RM3G
last-modified: Sat, 17 May 2025 23:21:24 GMT
etag: "ae4851600bcd2bf5ddde2c83e6e3bebe"
x-amz-server-side-encryption: AES256
server: AmazonS3
content-encoding: gzip
via: 1.1 varnish, 1.1 varnish
content-type: text/plain; charset=utf-8
accept-ranges: bytes
age: 0
date: Wed, 23 Jul 2025 21:13:29 GMT
x-served-by: cache-tyo11976-TYO, cache-bom-vanm7210098-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753305209.393240,VS0,VE514
vary: Accept-Encoding
content-length: 831
From: "karthikc (Karthik Chandrasekariah) via ruby-core"
Date: 2025-05-17T23:10:04+00:00
Subject: [ruby-core:122175] [Ruby Misc#21348] Should Tracepoint track retry as another "call" event?
Issue #21348 has been reported by karthikc (Karthik Chandrasekariah).
----------------------------------------
Misc #21348: Should Tracepoint track retry as another "call" event?
https://bugs.ruby-lang.org/issues/21348
* Author: karthikc (Karthik Chandrasekariah)
* Status: Open
----------------------------------------
When `retry` is executed in a method, Tracepoint records it as a new "call" event.
``` ruby
# tracepoint-retry.rb
# method that retries once
def foo
attempts ||= 1
raise "Fail" if attempts == 1
rescue
attempts += 1
retry
end
trace = TracePoint.new(:call, :return) do |tp|
p [tp.event, tp.method_id]
end
trace.enable
foo
```
``` shell
$ ruby -v
ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [x86_64-darwin24]
$ ruby tracepoint-retry.rb
[:call, :foo]
[:call, :foo]
[:return, :foo]
```
It results in multiple "call" events and a single "return" event. Since the `retry` doesn't technically leave and re-enter the method, should we change Tracepoint to not fire the second "call" event?
Context - I am building a library that tracks everything that happened in a block of code. This behavior makes it look like `foo` was called within `foo` but the outer call never returned/completed.
--
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/