When the `linuxcnc` script launches linuxcnc it starts Task, then loads motmod (as one of the commands in the [HAL]HALFILE list).

I believe this is racey, leading to at least some of the intermittent failures on the buildbot.

Task does this at startup:

1. Runs `usrmotInit()` which connects to the emcmotStruct shm, including emcmotCommand and emcmotStatus.

2. Runs `usrmotWriteEmcmotCommand()` to copy the first initialization command into emcmotCommand, then polls emcmotStatus waiting for motmod to echo the first command's commandNum.

3. If the commandNum does not echo in emcmotStatus within a timeout, Task gives up on the command.

Motion/motmod does this at startup:

1. Runs `init_comm_buffers()` to connect to the emcmotStruct shm, including emcmotCommand and emcmotStatus. Calls `memset()` on emcmotStruct to initialize it to all-bytes-zero.

2. Start polling emcmotCommand for new commands (this happens in a hal thread via the `motion-command-handler` function).

The race happens when Task does its 1 and 2, then Motion does *its* 1, discarding Task's first command.


I think the recent move of iocontrol into Task changed system timing and made this race more likely to bite.

Any thoughts?


--
Sebastian Kuzminsky


_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to