Frozen/Deadlocked Ruby thread instead of NoMethodError
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start by reproducing the provided Grape::Entity Invoice example with the two-argument expose block and the missing object receiver. Trace the expose block's yield and error handling to identify why the mistake deadlocks instead of raising NoMethodError. Done means the example raises NoMethodError and a regression test covers the behavior.
Written by the indexing model from the issue text.
Description
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)
- Dominant language
- Ruby
- Stars
- 730
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby-grape/grape-entity
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
ruby-grape/grape-entity#386 · 7 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ruby-grape/grape-entity#382 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ruby-grape/grape-entity#380 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
ruby-grape/grape-entity#373 · 2 comments ·
-
Truncate FormatterOpen
Difficulty 1/5 1-3 hours Newbie friendliness 45/100
ruby-grape/grape-entity#372 ·
All issues in ruby-grape/grape-entity
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
rubys/roundhouse#444 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
sclorg/s2i-ruby-container#656 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
yegor256/rubocop-elegant#92 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ecosyste-ms/awesome#812 ·
Maintainers usually reply within 2 days