Skip to content

Driver station crash on startup - possible race condition #1884

@acharraggi

Description

@acharraggi

There are some reports from the field that the Driver Station, or Driver Hub will crash on startup, but on restart be fine.

REV sent us a log:

08-29 10:39:50.036  1310  1341 E AndroidRuntime: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:8372)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.ViewRootImpl.focusableViewAvailable(ViewRootImpl.java:4273)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:940)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:940)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:940)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:940)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:940)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:940)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:940)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.View.setFlags(View.java:15732)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.view.View.setVisibility(View.java:11372)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.widget.ImageView.setVisibility(ImageView.java:1685)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at com.qualcomm.ftcdriverstation.FtcDriverStationActivity.testDriverStationRobotMismatch(FtcDriverStationActivity.java:1765)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at com.qualcomm.ftcdriverstation.FtcDriverStationActivity.onNetworkConnectionEvent(FtcDriverStationActivity.java:1686)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at org.firstinspires.ftc.robotcore.internal.network.NetworkConnectionHandler$NetworkConnectionCallbackChainer.onNetworkConnectionEvent(NetworkConnectionHandler.java:707)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at com.qualcomm.robotcore.wifi.NetworkConnection.sendEvent(NetworkConnection.java:186)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at com.qualcomm.robotcore.wifi.DriverStationAccessPointAssistant.onWiFiNetworkConnected(DriverStationAccessPointAssistant.java:427)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at com.qualcomm.robotcore.wifi.DriverStationAccessPointAssistant$2.onAvailable(DriverStationAccessPointAssistant.java:147)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.net.ConnectivityManager$NetworkCallback.onAvailable(ConnectivityManager.java:3256)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.net.ConnectivityManager$CallbackHandler.handleMessage(ConnectivityManager.java:3474)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:107)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:214)
08-29 10:39:50.036  1310  1341 E AndroidRuntime: 	at android.os.HandlerThread.run(HandlerThread.java:67)
08-29 10:39:50.095  1310  1310 V DriverStation: Lifecycle onPause() : bb28929
08-29 10:39:50.142  1310  1341 I Process : Sending signal. PID: 1310 SIG: 9

This is because the code that checks device names for team number mismatches is not running on the Android UI thread.

A work around is to keep trying until the driver station starts properly. Then change the robot and driver station names to match.
https://ftc-docs.firstinspires.org/en/latest/programming_resources/shared/managing_smartphone_ds/Managing-a-Smartphone-Driver-Station.html?highlight=device+names

This will be fixed in the 11.1 release expected in January.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions