Skip to content

lsp-test: fromJust crash in sendRequest #330

Open
@pepeiborra

Description

@pepeiborra

My tests randomly crash with:

test-binary: Maybe.fromJust: Nothing
CallStack (from HasCallStack):
  error, called at libraries/base/Data/Maybe.hs:148:21 in base:Data.Maybe
  fromJust, called at src/Language/LSP/Test.hs:327:20 in lsp-test-0.14.0.0-26fxKpgpCT6HDpy4E8JMz7:Language.LSP.Test

                                          
### Error in:   Unit tests - Dirties generateTargets after file edit
Timed out waiting to receive a message from the server.
Cases: 1  Tried: 1  Errors: 1  Failures: 0

Could this be a concurrency issue? The code doesn't seem thread-safe:

idn <- curReqId <$> get
modify $ \c -> c { curReqId = idn+1 }
let id = IdInt idn
let mess = RequestMessage "2.0" id method params
-- Update the request map
reqMap <- requestMap <$> ask
liftIO $ modifyMVar_ reqMap $
\r -> return $ fromJust $ updateRequestMap r id method

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions