When starting an Alda REPL session, the REPL server finds an available player process (i.e. one in the "ready" state) and "claims" it by sending it a ping message. This puts the player process into the "active" state, which makes Alda more eager to spawn new player processes in order to have them readily available.
This works reliably, but it seems to be a little too reliable in that, for some reason, two player processes seem to go from "ready" to "active" when the REPL server starts.
Steps to Reproduce
In a separate terminal, monitor the state of the player processes by running watch alda ps.
Start from a clean state by running alda shutdown to shut down all current player processes.
Run alda -v2 repl to start a REPL session in verbose mode.
Exit the session and start a new one.
Repeat step 4.
Expected Behavior
Each time a REPL session is started, only 1 of the players in the "ready" state goes into the "active" state.
Alda spawns more player processes as needed, but it shouldn't need to do that too much, because only one process becomes unavailable for each REPL session.
Actual Behavior
The first time I start a REPL server session, I see 5 players in the "ready" state and 1 player in the "active" state. The REPL server output shows that it is using the 1 player in the "active" state.
When I exit that session and start another one, 2 of the players that were in the "ready" state go into the "active" state. One of them is the one that this new REPL session is using. We are now down to 3 players in the "ready" state.
If I keep going, exiting and starting new REPL sessions, more and more player processes are spawned to ensure that there are always player processes available in the "ready" state.
Environment
Operating system and version: Ubuntu 20.04
Alda version:
$ alda version
alda 2.2.1
$ alda-player info
alda-player 2.2.1
log path: /home/dave/.cache/alda/logs
🐞 Bug report 🐞
Description
When starting an Alda REPL session, the REPL server finds an available player process (i.e. one in the "ready" state) and "claims" it by sending it a ping message. This puts the player process into the "active" state, which makes Alda more eager to spawn new player processes in order to have them readily available.
This works reliably, but it seems to be a little too reliable in that, for some reason, two player processes seem to go from "ready" to "active" when the REPL server starts.
Steps to Reproduce
watch alda ps
.alda shutdown
to shut down all current player processes.alda -v2 repl
to start a REPL session in verbose mode.Expected Behavior
Each time a REPL session is started, only 1 of the players in the "ready" state goes into the "active" state.
Alda spawns more player processes as needed, but it shouldn't need to do that too much, because only one process becomes unavailable for each REPL session.
Actual Behavior
The first time I start a REPL server session, I see 5 players in the "ready" state and 1 player in the "active" state. The REPL server output shows that it is using the 1 player in the "active" state.
When I exit that session and start another one, 2 of the players that were in the "ready" state go into the "active" state. One of them is the one that this new REPL session is using. We are now down to 3 players in the "ready" state.
If I keep going, exiting and starting new REPL sessions, more and more player processes are spawned to ensure that there are always player processes available in the "ready" state.
Environment
Operating system and version: Ubuntu 20.04
Alda version:
Health check: