After updating one of our applications to Ruby 3.1.0, it started crashing with stacktraces like the following one:
/Users/user/.rvm/gems/ruby-3.1.0@logjam/gems/mongo-2.17.0/lib/mongo/cluster/reapers/cursor_reaper.rb:59:in `synchronize': can't be called from trap context (ThreadError)/Users/user/.rvm/gems/ruby-3.1.0@logjam/gems/mongo-2.17.0/lib/mongo/cluster/reapers/cursor_reaper.rb:59:in `synchronize': can't be called from trap context (ThreadError) from /Users/user/.rvm/gems/ruby-3.1.0@logjam/gems/mongo-2.17.0/lib/mongo/cluster/reapers/cursor_reaper.rb:59:in `schedule_kill_cursor' from /Users/user/.rvm/gems/ruby-3.1.0@logjam/gems/mongo-2.17.0/lib/mongo/cluster.rb:350:in `block (2 levels) in <class:Cluster>' from /Users/user/.rvm/gems/ruby-3.1.0@logjam/gems/mongo-2.17.0/lib/mongo/cursor.rb:115:in `block in finalize'