Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frozen/Deadlocked Ruby thread instead of NoMethodError #357

Open
danielricecodes opened this issue Sep 17, 2021 · 1 comment
Open

Frozen/Deadlocked Ruby thread instead of NoMethodError #357

danielricecodes opened this issue Sep 17, 2021 · 1 comment

Comments

@danielricecodes
Copy link

danielricecodes commented Sep 17, 2021

I am not sure if this is a known issue or not, but when yielding to a block w/ 2 arguments (e.g. arity = 2) its possible to freeze your app / test code. The following coding mistake should have resulted in a NoMethodError. Instead, Ruby freezes and I have to kill -9 the thread.

The following will freeze my app in its tracks. It should throw a NoMethodError.

module Entities
  class Invoice < Grape::Entity
    expose :id
    expose(:foo) do |object, options|
      bar.to_s
    end
  end
end

The only mistake above was not referencing object first.

module Entities
  class Invoice < Grape::Entity
    expose :id
    expose(:foo) do |object, options|
      object.bar.to_s
    end
  end
end

I'm happy to try to fix this - but first I'm asking if anyone else has noticed this or maybe there is already a PR for something similar?

Versions

Ruby 2.7.3
Rails 6.1
grape (1.5.3)
grape-entity (0.9.0)

@LeFnord
Copy link
Member

LeFnord commented Oct 14, 2021

never heared about it, but it sounds reasonable …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants