• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-grape / grape / 29092270000 / 11
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: fix/recompile-settings-mutation-race
DEFAULT BRANCH: master
Ran 10 Jul 2026 12:23PM UTC
Files 167
Run time 9s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Jul 2026 12:20PM UTC coverage: 95.21% (+0.006%) from 95.204%
29092270000.11

Pull #2790

github

ericproulx
Don't mutate router maps at request time

Grape::Router built @map and @optimized_map as auto-vivifying hashes
(Hash.new { |h, k| h[k] = ... }). compile! only fills keys for HTTP
methods that have routes, but at request time #match? and #rotation look
the maps up by the request's method, so any method with no routes inserted
a key into the shared hashes. The router is frozen only shallowly, so the
inner hashes stayed mutable.

That is a data race on runtimes without a GVL (JRuby, TruffleRuby), where
concurrent Hash#[]= corrupts the hash, and unbounded growth everywhere:
each distinct method string becomes a permanent key, so a client sending
arbitrary methods grows the maps without limit.

Use plain hashes, create the array explicitly on append, freeze both maps
after compile!, and read missing keys without inserting (#match? via safe
navigation, #rotation via &.each). Requests with an unrouted method still
resolve to 404/405 exactly as before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pull Request #2790: Don't mutate router maps at request time

1105 of 1224 branches covered (90.28%)

Branch coverage included in aggregate %.

3546 of 3661 relevant lines covered (96.86%)

969.55 hits per line

Source Files on job run-3.4-gemfiles/rails_8_1.gemfile - 29092270000.11
  • Tree
  • List 167
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 29092270000
  • 1ff2af67 on github
  • Prev Job for on fix/router-request-time-map-mutation (#28782563800.12)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc