temporalio / temporalio/sdk-ruby
[Bug] ScopedLogger fails attempting to compare symbol to integer for libraries like semantic_logger
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 204
- Forks
- 42
- Avg merge
- 1d 30m
- Merged PRs (30d)
- 28
Description
What are you really trying to do?
I'm running Temporal alongside a Rails application, starting the Temporal worker with a Rails runner script like in the example.
Describe the bug
Workflows are failing on exceptions bubbling up from ScopedLogger on this line:
When I inspect those values, severity is 2, Logger::Unknown is undefined (should be Logger::UNKNOWN?), and level is :debug.
comparison of Integer with :debug failed
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/scoped_logger.rb:20:in 'Integer#<'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/scoped_logger.rb:20:in 'Temporalio::ScopedLogger#add'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance/replay_safe_logger.rb:31:in 'block in Temporalio::Internal::Worker::WorkflowInstance::ReplaySafeLogger#add'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb:134:in 'block in Temporalio::Internal::Worker::WorkflowInstance::IllegalCallTracer#disable'
<internal:trace_point>:297:in 'TracePoint#disable'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb:133:in 'Temporalio::Internal::Worker::WorkflowInstance::IllegalCallTracer#disable'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance.rb:197:in 'Temporalio::Internal::Worker::WorkflowInstance#illegal_call_tracing_disabled'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance/replay_safe_logger.rb:31:in 'Temporalio::Internal::Worker::WorkflowInstance::ReplaySafeLogger#add'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/scoped_logger.rb:57:in 'Temporalio::ScopedLogger#warn'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance.rb:289:in 'block in Temporalio::Internal::Worker::WorkflowInstance#activate_internal'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance/replay_safe_logger.rb:20:in 'Temporalio::Internal::Worker::WorkflowInstance::ReplaySafeLogger#replay_safety_disabled'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance.rb:288:in 'Temporalio::Internal::Worker::WorkflowInstance#activate_internal'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance.rb:166:in 'block in Temporalio::Internal::Worker::WorkflowInstance#activate'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb:125:in 'block in Temporalio::Internal::Worker::WorkflowInstance::IllegalCallTracer#enable'
<internal:trace_point>:261:in 'TracePoint#enable'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb:124:in 'Temporalio::Internal::Worker::WorkflowInstance::IllegalCallTracer#enable'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance.rb:236:in 'Temporalio::Internal::Worker::WorkflowInstance#run_in_scheduler'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/internal/worker/workflow_instance.rb:166:in 'Temporalio::Internal::Worker::WorkflowInstance#activate'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/worker/workflow_executor/thread_pool.rb:163:in 'block in Temporalio::Worker::WorkflowExecutor::ThreadPool::Worker#activate'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/timeout-0.4.3/lib/timeout.rb:185:in 'block in Timeout.timeout'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/timeout-0.4.3/lib/timeout.rb:192:in 'Timeout.timeout'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/worker/workflow_executor/thread_pool.rb:149:in 'Temporalio::Worker::WorkflowExecutor::ThreadPool::Worker#activate'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/worker/workflow_executor/thread_pool.rb:124:in 'block in Temporalio::Worker::WorkflowExecutor::ThreadPool::Worker#run'
<internal:kernel>:168:in 'Kernel#loop'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/worker/workflow_executor/thread_pool.rb:115:in 'Temporalio::Worker::WorkflowExecutor::ThreadPool::Worker#run'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/worker/workflow_executor/thread_pool.rb:99:in 'block in Temporalio::Worker::WorkflowExecutor::ThreadPool::Worker#initialize'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/worker/thread_pool.rb:200:in 'block (3 levels) in Temporalio::Worker::ThreadPool::Worker#initialize'
<internal:kernel>:168:in 'Kernel#loop'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/worker/thread_pool.rb:193:in 'block (2 levels) in Temporalio::Worker::ThreadPool::Worker#initialize'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/worker/thread_pool.rb:192:in 'Kernel#catch'
/Users/joseph/.rvm/gems/ruby-3.4.2/gems/temporalio-0.5.0-arm64-darwin/lib/temporalio/worker/thread_pool.rb:192:in 'block in Temporalio::Worker::ThreadPool::Worker#initialize'
Environment/Versions
- OS and processor: M1 Mac
- Using the
temporalio/auto-setup:latestDocker image
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with temporalio/lib/temporalio/scoped_logger.rb at line 20 and inspect how ScopedLogger#add handles severity and level values. Reproduce the failure with a Rails runner using semantic_logger, then trace the call through temporalio/internal/worker/workflow_instance/replay_safe_logger.rb. Done means workflow logging no longer compares incompatible integer and symbol values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100