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

ruby-grape / grape / 29092242866 / 12
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: fix/recompile-settings-mutation-race
DEFAULT BRANCH: master
Ran 10 Jul 2026 12:22PM UTC
Files 166
Run time 7s
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: 62.385% (-0.02%) from 62.4%
29092242866.12

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

394 of 1224 branches covered (32.19%)

Branch coverage included in aggregate %.

2651 of 3657 relevant lines covered (72.49%)

7.76 hits per line

Source Files on job run-4.0-gemfiles/hashie.gemfile - 29092242866.12
  • Tree
  • List 166
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 29092242866
  • 261fcbd2 on github
  • Prev Job for on fix/router-request-time-map-mutation (#28782563800.26)
  • Next Job for on fix/router-request-time-map-mutation (#29092270000.24)
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