Why an arm keeps moving after canceling a long action goal
If an action server checks the cancel flag only at the end of a cycle, the robot finishes the current move after cancel is requested.
How to test it
Send a cancel request mid-execution and time both state transition and physical stop. Ensure every loop step polls cancellation and exits cleanly.

ZHILIANHAI