Skip to content

linuxcncrsh: wait for task to receive SET ESTOP and SET MACHINE - #4957

Open
grandixximo wants to merge 2 commits into
LinuxCNC:masterfrom
grandixximo:t0-nonrandom-flake
Open

grandixximo wants to merge 2 commits into
LinuxCNC:masterfrom
grandixximo:t0-nonrandom-flake

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

tests/t0/nonrandom failed on the arm package job of #4955 with every MDI line refused: "Machine must be 'ON' for SET MDI".

SET ESTOP and SET MACHINE send the state command, then watch the motion heartbeat in task's status and give up after one second without one. On an estop reset the interpreter rewrites the parameter file and calls fdatasync(); on a slow disk that takes seconds (task logged "main loop took 3.45 seconds" in that run), and task publishes no status meanwhile. linuxcncrsh NAKed both commands, the test does not check the reply, and the machine never came on.

The fix waits for task to echo the command before watching the heartbeat.

I reproduced it by delaying that fdatasync() by 3.45 s with an LD_PRELOAD shim: without the change t0/nonrandom fails the same way, with it it passes. The linuxcncrsh-driven tests (t0, linuxcncrsh, linuxcncrsh-tcp, toolchanger, mdi-queue, motion/g0) pass on two CPUs under load.

tests/t0/nonrandom failed once on an arm CI runner with every MDI line
refused: "Machine must be 'ON' for SET MDI".

SET ESTOP and SET MACHINE send the state command and then watch the
motion heartbeat in task's status for the new state, giving up after one
second without a heartbeat. On a state change the interpreter writes the
parameter file and calls fdatasync(). On a slow disk that call can take
seconds, and task publishes no status meanwhile, so the heartbeat stands
still. linuxcncrsh then reported a failure for a command that task was
still working on, went on to the next one, and the machine never came on.

Wait for task to echo the command before watching the heartbeat.

Tested by delaying that fdatasync() by 3.45 s with a preload shim:
t0/nonrandom fails the same way as on CI without the change and passes
with it.
Comment thread src/emc/usr_intf/emcrsh.cc Resolved
emcTimeout is 0 in linuxcncrsh, so the wait added for SET ESTOP and
SET MACHINE blocked every client for as long as task did not answer.
Move it to a helper that waits at most 10 s, and use it in
SET JOINT_HOME too, which watches the heartbeat the same way.
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