ChainMovers / suibase

Sui development environment and cookbook.
https://suibase.io
Apache License 2.0
35 stars 6 forks source link

localnet stop/status still showing running #79

Closed FrankC01 closed 3 weeks ago

FrankC01 commented 9 months ago
$ localnet stop
Stopping localnet (process pid 4202)
...............
Error: Sui process pid=4593 still running. Try again, or stop (kill) the sui process yourself before proceeding.

$ localnet status
localnet STOPPED
---
localnet process : STILL RUNNING (pid 4593)
multi-link RPC   :  (  )
---
client version: sui 1.9.1-8c2cf85
asui selection: [ localnet ]
mario4tier commented 9 months ago

Thanks for reporting this.

Bug in suibase is now fix.

Details

get_process_pid() was returning the wrong PID for the "sui" process on MacOS. It was instead likely returning the PID of another process with "sui" in the name (e.g. may be sui-indexer!?)

Two things are part of this fix:

Long Term Fix

Commit 5297125 is making things significantly more robust. But there is still some unlikely race condition possible. Examples:

These should be fix with a mechanism to prevent concurrent execution of the Suibase scripts (e.g. block until other script execution completes).

mario4tier commented 3 weeks ago

With this fix, command done at same time (e.g. from two terminals) for same workdir will be executed sequentially, which is more safe.

Command for different workdirs can still be executed in parallel.

(the "status" command do not modify anything, so it does not need the mutex and is allowed to be done concurrently)