Skip to content

Conversation

@catchvoid
Copy link

When running a simple greskell test command-line binary, the following error is encountered:

gr-test-exe: waitAnySTM: invalid argument: input list must be non-empty

Observations:

  • The code submits a basic query to a Gremlin Server (v3.7.3) and is expected to print a single response line.
  • The issue arises only in the compiled binary. Running the same code in GHCi works without any problems.
  • Same behaviour exists when connecting to a JanusGraphDB.

Issue:
The error can be traced to an unhandled empty list in the file:
greskell-websocket/src/Network/Greskell/WebSocket/Connection/Impl.hs

Environment Details:

  • Stack Version: 3.1.1
  • Stackage Snapshot: lts-22.39
  • Greskell Version: master branch
  • OS: Linux

Test code:

isMarko :: Walk Transform AVertex AVertex
isMarko = gHas2 "name" $ string "marko"

getMarkoAge :: Client -> IO (ResultHandle Integer)
getMarkoAge client = submit client (source "g" & sV [] &. isMarko &. gValues ["age"]) Nothing

submitExample :: IO ()
submitExample =
  bracket (connect "127.0.0.1" 8182) close $ \client -> do
    vs <- getMarkoAge client
    vectors <- slurpResults vs
    putStrLn $ "Marko's age is: " ++ show (Data.Vector.head vectors)

@debug-ito
Copy link
Owner

debug-ito commented Jan 23, 2025

Thanks!

Is it possible to write the test code in test/ServerTest/Connection.hs and reproduce the issue? Never mind.

@debug-ito
Copy link
Owner

I think this issue occurs on basically any operation on greskell-websocket if you use it with async-2.2.5 or newer.

async-2.2.5 includes async #132, which makes waitAnySTM immediately throw an exception if the input is an empty list. Before, it threw BlockedIndefinitelyOnSTM exception if there was no other STM event sources. In the case of greskell-websocket, however, there are a lot of other event sources, so waitAnySTM didn't need to throw BlockedIndefinitelyOnSTM in almost 100% cases, I think.

@catchvoid catchvoid force-pushed the bugfix/handle-empty-response-timer-list branch from be8d45d to f14306c Compare January 26, 2025 16:00
@catchvoid
Copy link
Author

I conducted a test using ghc-9.0.2 with async version 2.2.4. I verified that this version was used by running stack exec -- ghc-pkg list async, and I can confirm that the issue no longer occurs. Your assessment was spot on!

@catchvoid catchvoid closed this Jan 26, 2025
@debug-ito
Copy link
Owner

Thanks for confirmation. However, you didn't need to close the pull-request. The problem is greskell's fault, and we need to fix it.

@debug-ito debug-ito reopened this Jan 26, 2025
@debug-ito
Copy link
Owner

Thanks for the force-push. I'll test the code and release the fixed version later.

@debug-ito
Copy link
Owner

I tested the code and confirmed that it resolved the issue. Thanks!

@debug-ito debug-ito merged commit 34992f6 into debug-ito:master Jan 27, 2025
@catchvoid
Copy link
Author

Sorry I closed the PR a bit too early, I didn't fully understand the github workflow yet :-) Cool, you could merge it, Thanks!

@catchvoid catchvoid deleted the bugfix/handle-empty-response-timer-list branch January 27, 2025 21:24
@debug-ito
Copy link
Owner

I just released greskell-websocket-1.0.0.4, which includes this p-r.

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

Successfully merging this pull request may close these issues.

2 participants