-
Notifications
You must be signed in to change notification settings - Fork 3.2k
"Restart Robot" abandons watchdog on active OpMode #709
Comments
@gearsincorg will this be fixed in v5.0 too? |
No. I've added it as an issue, but I'm not skilled in this area to attempt a fix. (Suggestions?) |
@gearsincorg I did some digging and it appears this issue can be fixed by adding the following as the first thing in if(eventLoop.getOpModeManager() != null)
{
eventLoop.getOpModeManager().stopActiveOpMode();
} |
Excellent... I can implement this in the current private repo and see if I can replicate your results. We appreciate your efforts to find and suggest fixes for these problem. Phil. |
@gearsincorg any update on this? |
Also, one other thing, I'd like to revise my suggested fix to: if(eventLoop.getOpModeManager() != null)
{
eventLoop.getOpModeManager().initActiveOpMode(OpModeManagerImpl.DEFAULT_OP_MODE_NAME);
} |
Why the switch? |
Because that's what's done when the DS sends the command to stop an OpMode. It doesn't call |
@FROGbots-4634 I've tested both of your proposed fixes. The first one successfully detects the stuck loop condition and aborts the running thread the same way it would do if a stop had been requested. The DS is sent the Stuck-Loop error and the RC restarts the app and comes up in a ready to run condition. The second suggestion did not appear to have any effect. The stuck opmode continued to run through the restart operation, and stayed in memory to permit multiple instances to execute. After some more testing, I'll be submitting the first approach as a change to the code base. Thanks for your input. |
@gearsincorg Ok cool! I never actually tested the second suggestion..... though don't really understand why it wouldn't work, given that's what the DS does. Then again I don't quite fully understand the state machine in |
@ftctechnh does this mean it was fixed in the internal repo? |
@FROGbots-4634 |
As I'm sure anyone who has ever written an autonomous OpMode knows, if your thread does not exit within 1000ms of a stop being requested, the watchdog growls, and the app force-crashes itself in order to terminate your rogue thread. (This is necessary because it is not possible to
kill -9
a single thread).However, I have found a serious bug in the implementation of the watchdog: it appears that the watchdog of the active OpMode is abandoned when a "Restart Robot" command is issued. This causes the RC device to perform a restart robot as if everything were normal, but the rogue thread continues to run in the background.
Here's a sample OpMode:
Steps to reproduce:
The text was updated successfully, but these errors were encountered: