You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
I am seeing this as curReqId conflict between SInitialize and SShutdown requests.
Both of them start with curReqId == 0 (SShutdown is being called from its own Session monad instance). Therefore there is a possibility that shutdown sees outstanding initialize request
on the shared requestMapMVar.
The following naive patch fixes this for me:
diff --git a/lsp-test/src/Language/LSP/Test.hs b/lsp-test/src/Language/LSP/Test.hs
index 46bb8e4..60484ca 100644
--- a/lsp-test/src/Language/LSP/Test.hs
+++ b/lsp-test/src/Language/LSP/Test.hs
@@ -232,7 +232,9 @@ runSessionWithHandles' serverProc serverIn serverOut config' caps rootDir ses
sio
where
-- | Asks the server to shutdown and exit politely
exitServer :: Session ()
- exitServer = request_ SShutdown Empty >> sendNotification SExit Empty
+ exitServer = do
+ modify $ \c -> c { curReqId = -1 }
+ request_ SShutdown Empty >> sendNotification SExit Empty
-- | Listens to the server output until the shutdown ack,
-- makes sure it matches the record and signals any semaphores
My tests randomly crash with:
Could this be a concurrency issue? The code doesn't seem thread-safe:
lsp/lsp-test/src/Language/LSP/Test.hs
Lines 318 to 327 in 6b34b5b
The text was updated successfully, but these errors were encountered: