trace.rb appends entries via @trace << entry in the middleware, while octo.rb print_trace! reads, selects, groups, and clears @trace. Array#<< is only atomic under MRI's GIL. On JRuby/TruffleRuby, concurrent << and .clear/.select can corrupt the array. Even on MRI, print_trace! reading while another thread appends can miss entries.
REPRODUCTION: Concurrent API requests while print_trace! is called from another thread.
IMPACT: Lost trace entries, incorrect trace statistics, potential NoMethodError on JRuby.
trace.rb appends entries via @trace << entry in the middleware, while octo.rb print_trace! reads, selects, groups, and clears @trace. Array#<< is only atomic under MRI's GIL. On JRuby/TruffleRuby, concurrent << and .clear/.select can corrupt the array. Even on MRI, print_trace! reading while another thread appends can miss entries.
REPRODUCTION: Concurrent API requests while print_trace! is called from another thread.
IMPACT: Lost trace entries, incorrect trace statistics, potential NoMethodError on JRuby.