Skip to content

Conversation

@slauwers
Copy link

Following the discussion around issue #665 in intridea/grape, this PR adds some contextual information when running the spec on the Ping API (bundle exec rspec spec/api/ping_spec.rb). Please note that the tests themselves have not been changed, only additional information is being displayed.

If you need the tests to expose the issue by actually testing for it and failing, please let me know. Upon running the ping spec, you should see something along the lines of:

Grape::Route 87 delta 71 Grape::Util::HashStack 68 delta 28 Grape::Endpoint 55 delta 28 

Please also note that sometimes, two other classes seem to not be properly GC'd, however I don't know how relevant this is to the issue at hand.

Grape::Route 87 delta 71 Grape::Util::HashStack 68 delta 28 Grape::Endpoint 56 delta 29 Grape::Request 1 delta 1 Grape::Cookies 1 delta 1 
@slauwers
Copy link
Author

Just for the record, I've added a few commits that also display the offending files where the allocations happened. For example, this is what I'm seeing on my machine:

Grape::Route 87 delta 71 # lib/grape/endpoint.rb:126 71 Grape::Util::HashStack 68 delta 28 # lib/grape/util/hash_stack.rb:111 28 Grape::Endpoint 56 delta 29 # lib/grape/endpoint.rb:156 1 # lib/grape/api.rb:365 28 Grape::Path 33 delta 33 # lib/grape/path.rb:4 33 Grape::Request 1 delta 1 # lib/grape/endpoint.rb:396 1 Grape::Cookies 1 delta 1 # lib/grape/endpoint.rb:293 1 

From this, I'm starting to suspect lib/grape/api.rb:365 to be involved in this. I'll keep looking and post my findings.

@dblock
Copy link
Member

dblock commented Jun 18, 2022

For the record, I retried this today on https://github.com/dblock/grape-on-rack/tree/INTERACT-IV-expose-potential-leaks with some minor changes (warm up and GC.start) and it didn't show any leaks. Leaving this open because this is some nice code to debug Grape memory. Maybe it can be turned into a library or something?

@INTERACT-IV INTERACT-IV closed this by deleting the head repository Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants