Repository navigation
Fix crash when suggest_contracts is called without a PLT - #1284
Merged
Merged
Conversation
… PLT
DialyzerIncremental.handle_call/3 only matched {:suggest_contracts, files}
when plt != nil. A freshly (re)started process has plt: nil while the
initial analysis is running, so the call crashed the GenServer with a
FunctionClauseError and the waiting request never got a reply.
Add a fallback clause that replies with an empty list, and cover it with
tests for handle_call/3 with plt: nil and for suggest_contracts/2 when no
DialyzerIncremental process is running.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Crash report:
DialyzerIncremental.handle_call({:suggest_contracts, files}, ...)only had a clause guarded byplt != nil. A freshly (re)started process hasplt: nilwhile the initial analysis runs, so the call crashed the GenServer and the waiting request never got a reply.Fix
handle_call({:suggest_contracts, _files}, _from, state)clause that replies[]when there is no PLT.DialyzerIncremental.suggest_contracts/2already catches exits (for example:noproc) and returns[], so the spawned Server processes still reply to waiting clients. No change there.Tests
handle_call/3withplt: nilreplies{:reply, [], state}.suggest_contracts/2returns[]when no DialyzerIncremental process is running for the parent.