Closed
Description
openedon Mar 7, 2024
Issue Description
The method name Sentry::Scope#set_transaction_name
suggests that it is a simple setter, but in fact it appends the specified name to an array. AFAICT this array is never popped/truncated, so if #set_transaction_name
is called e.g. in an event loop, the array will grow unlimited.
I know that Sentry.with_scope
is often a better solution inside a loop, but this is not always a feasible solution, e.g. if exceptions are rescued outside the loop.
Reproduction Steps
while true do
Sentry.configure_scope do |scope|
scope.set_transaction_name('foo')
p scope.transaction_names.size
end
end
Expected Behavior
The transaction names should not accumulate.
Actual Behavior
An ever increasing number is output, proving that the Sentry::Scope#transaction_names
array keeps growing. Eventually a NoMemoryError
is raised.
Ruby Version
3.2.3
SDK Version
5.15.0
Integration and Its Version
No response
Sentry Config
No response
Metadata
Assignees
Type
Projects
Status
No status
Status
No status
Activity