ftctechnh / ftc_app

FTC Android Studio project to create FTC Robot Controller app.
761 stars 3.16k forks source link

Possible deadlock / race condition when hotplugging USB devices? #626

Open Windwoes opened 6 years ago

Windwoes commented 6 years ago

While testing webcam code, I discovered that sometimes, when hotplugging the webcam after the initial USB scan, the SDK does not pick it up properly.

The log shows that it was re-attcahed:

06-21 17:58:06.709 10213-10213/com.qualcomm.ftcrobotcontroller V/RCActivity: ACTION_USB_DEVICE_ATTACHED: /dev/bus/usb/001/003
06-21 17:58:06.709 10213-10213/com.qualcomm.ftcrobotcontroller V/RCActivity: onResume()
06-21 17:58:06.709 10213-10244/com.qualcomm.ftcrobotcontroller D/Uvc: [init.cpp:131] calling libusb_exit()
06-21 17:58:06.710 10213-10244/com.qualcomm.ftcrobotcontroller D/libusb: [ 5.742823] [00002804] libusb: debug [op_init] sysfs(/sys/bus/usb/devices) available
06-21 17:58:06.710 10213-10244/com.qualcomm.ftcrobotcontroller D/libusb: [ 5.742843] [00002804] libusb: debug [op_init] sysfs can relate devices
06-21 17:58:06.710 10213-10244/com.qualcomm.ftcrobotcontroller D/libusb: [ 5.742859] [00002804] libusb: debug [op_init] sysfs has complete descriptors
06-21 17:58:06.710 10213-10244/com.qualcomm.ftcrobotcontroller D/libusb: [ 5.742876] [00002804] libusb: debug [op_init] sysfs has serial numbers
06-21 17:58:06.710 10213-10329/com.qualcomm.ftcrobotcontroller I/FtcEventLoop: vv===== MODULE ATTACH: disarm Webcam [03FA436F]=====vv

But the yellow warning message does not go away.

Additionally, in this state, if "restart robot" is pressed, the app freezes for 5 seconds and then crashes. Here's the log of that:

06-21 17:58:53.737 10213-10213/com.qualcomm.ftcrobotcontroller V/ThreadPool: waiting for service EventLoop
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller V/ThreadPool: awaiting shutdown: thread pool="EventLoop" attempt=3
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore: thread id=316 tid=10329 name="opmode loop()" 
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.CameraManagerImpl.unregisterReceiver(CameraManagerImpl.java:172)
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.names.WebcamNameImpl$ArmableDeviceHelper$3.run(WebcamNameImpl.java:587)
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.system.Tracer.trace(Tracer.java:140)
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.names.WebcamNameImpl$ArmableDeviceHelper.disarmDevice(WebcamNameImpl.java:582)
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.hardware.usb.ArmableUsbDevice.doDisarm(ArmableUsbDevice.java:504)
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.hardware.usb.ArmableUsbDevice$3.run(ArmableUsbDevice.java:478)
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.system.Tracer.trace(Tracer.java:221)
06-21 17:58:56.237 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.hardware.usb.ArmableUsbDevice.disarm(ArmableUsbDevice.java:462)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.names.WebcamNameImpl.disarm(WebcamNameImpl.java:635)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.ftccommon.FtcEventLoop$DefaultUsbModuleAttachmentHandler.handleUsbModuleAttach(FtcEventLoop.java:543)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.ftccommon.FtcEventLoop.handleUsbModuleAttach(FtcEventLoop.java:532)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.ftccommon.FtcEventLoop.processedRecentlyAttachedUsbDevices(FtcEventLoop.java:507)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.eventloop.EventLoopManager$EventLoopRunnable$1.run(EventLoopManager.java:290)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool.logThreadLifeCycle(ThreadPool.java:737)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.eventloop.EventLoopManager$EventLoopRunnable.run(EventLoopManager.java:239)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.eventloop.EventLoopManager$1.run(EventLoopManager.java:564)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool$ThreadFactoryImpl$1.run(ThreadPool.java:793)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.run(Thread.java:818)
06-21 17:58:56.238 10213-10213/com.qualcomm.ftcrobotcontroller V/ThreadPool: waiting for service EventLoop
06-21 17:58:58.728 10213-10213/com.qualcomm.ftcrobotcontroller E/ThreadPool: deadline expired waiting for service termination: EventLoop
06-21 17:58:58.728 10213-10213/com.qualcomm.ftcrobotcontroller V/ThreadPool: executive service EventLoop(0x021efd4a) is NOT terminated
06-21 17:58:58.729 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore: thread id=311 tid=10314 name="ReceiveLoopService-#0" 
06-21 17:58:58.730 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Object.wait(Native Method)
06-21 17:58:58.730 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.parkFor$(Thread.java:1220)
06-21 17:58:58.730 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at sun.misc.Unsafe.park(Unsafe.java:299)
06-21 17:58:58.731 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
06-21 17:58:58.731 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
06-21 17:58:58.731 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.LinkedBlockingDeque.takeFirst(LinkedBlockingDeque.java:460)
06-21 17:58:58.731 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.network.RecvLoopRunnable$CommandProcessor.run(RecvLoopRunnable.java:102)
06-21 17:58:58.732 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-21 17:58:58.732 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-21 17:58:58.732 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool$ThreadFactoryImpl$1.run(ThreadPool.java:793)
06-21 17:58:58.732 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.run(Thread.java:818)
06-21 17:58:58.733 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore: thread id=312 tid=10316 name="RecvLoopRunnable.run()" 
06-21 17:58:58.733 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at libcore.io.Posix.recvfromBytes(Native Method)
06-21 17:58:58.734 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at libcore.io.Posix.recvfrom(Posix.java:189)
06-21 17:58:58.734 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:250)
06-21 17:58:58.734 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at libcore.io.IoBridge.recvfrom(IoBridge.java:549)
06-21 17:58:58.734 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java:163)
06-21 17:58:58.734 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:171)
06-21 17:58:58.735 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.net.DatagramSocket.receive(DatagramSocket.java:274)
06-21 17:58:58.735 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.robocol.RobocolDatagramSocket.recv(RobocolDatagramSocket.java:138)
06-21 17:58:58.735 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.network.RecvLoopRunnable$1.run(RecvLoopRunnable.java:153)
06-21 17:58:58.735 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool.logThreadLifeCycle(ThreadPool.java:737)
06-21 17:58:58.736 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.network.RecvLoopRunnable.run(RecvLoopRunnable.java:143)
06-21 17:58:58.736 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-21 17:58:58.736 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-21 17:58:58.736 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool$ThreadFactoryImpl$1.run(ThreadPool.java:793)
06-21 17:58:58.736 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.run(Thread.java:818)
06-21 17:58:58.737 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore: thread id=302 tid=10280 name="MTPMonitor-#0" 
06-21 17:58:58.737 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.sleep(Native Method)
06-21 17:58:58.737 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.sleep(Thread.java:1031)
06-21 17:58:58.738 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.sleep(Thread.java:985)
06-21 17:58:58.738 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.files.MediaTransferProtocolMonitor$1.run(MediaTransferProtocolMonitor.java:134)
06-21 17:58:58.738 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
06-21 17:58:58.738 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-21 17:58:58.738 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-21 17:58:58.739 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-21 17:58:58.739 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool$ThreadFactoryImpl$1.run(ThreadPool.java:793)
06-21 17:58:58.739 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.run(Thread.java:818)
06-21 17:58:58.739 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore: thread id=323 tid=10343 name="SoundPlayerScheduler-#0" 
06-21 17:58:58.740 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Object.wait(Native Method)
06-21 17:58:58.740 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.parkFor$(Thread.java:1220)
06-21 17:58:58.747 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at sun.misc.Unsafe.park(Unsafe.java:299)
06-21 17:58:58.748 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
06-21 17:58:58.748 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
06-21 17:58:58.748 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1078)
06-21 17:58:58.748 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1071)
06-21 17:58:58.749 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
06-21 17:58:58.749 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
06-21 17:58:58.749 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-21 17:58:58.749 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool$ThreadFactoryImpl$1.run(ThreadPool.java:793)
06-21 17:58:58.749 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.run(Thread.java:818)
06-21 17:58:58.750 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore: thread id=315 tid=10327 name="SoundPlayer-#0" 
06-21 17:58:58.750 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Object.wait(Native Method)
06-21 17:58:58.752 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.parkFor$(Thread.java:1220)
06-21 17:58:58.752 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at sun.misc.Unsafe.park(Unsafe.java:299)
06-21 17:58:58.752 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
06-21 17:58:58.753 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
06-21 17:58:58.753 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
06-21 17:58:58.753 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
06-21 17:58:58.753 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
06-21 17:58:58.753 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-21 17:58:58.754 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool$ThreadFactoryImpl$1.run(ThreadPool.java:793)
06-21 17:58:58.754 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.run(Thread.java:818)
06-21 17:58:58.755 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore: thread id=283 tid=10244 name="callback looper" 
06-21 17:58:58.756 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.names.WebcamNameImpl$ArmableDeviceHelper.checkAttached(WebcamNameImpl.java:489)
06-21 17:58:58.756 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.names.WebcamNameImpl$ArmableDeviceHelper.onAttached(WebcamNameImpl.java:479)
06-21 17:58:58.756 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.CameraManagerImpl$UsbAttachmentMonitor.onReceive(CameraManagerImpl.java:208)
06-21 17:58:58.757 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:882)
06-21 17:58:58.757 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at android.os.Handler.handleCallback(Handler.java:739)
06-21 17:58:58.757 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at android.os.Handler.dispatchMessage(Handler.java:95)
06-21 17:58:58.757 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at android.os.Looper.loop(Looper.java:148)
06-21 17:58:58.757 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.network.CallbackLooper$1.run(CallbackLooper.java:139)
06-21 17:58:58.758 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
06-21 17:58:58.758 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-21 17:58:58.758 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-21 17:58:58.758 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-21 17:58:58.759 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool$ThreadFactoryImpl$1.run(ThreadPool.java:793)
06-21 17:58:58.759 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.run(Thread.java:818)
06-21 17:58:58.759 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore: thread id=326 tid=10359 name="OpModeStuckCodeMonitor-#0" 
06-21 17:58:58.760 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Object.wait(Native Method)
06-21 17:58:58.760 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.parkFor$(Thread.java:1220)
06-21 17:58:58.760 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at sun.misc.Unsafe.park(Unsafe.java:299)
06-21 17:58:58.760 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
06-21 17:58:58.760 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
06-21 17:58:58.761 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
06-21 17:58:58.761 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038)
06-21 17:58:58.761 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
06-21 17:58:58.761 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-21 17:58:58.762 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool$ThreadFactoryImpl$1.run(ThreadPool.java:793)
06-21 17:58:58.762 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.run(Thread.java:818)
06-21 17:58:58.762 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore: thread id=316 tid=10329 name="opmode loop()" 
06-21 17:58:58.763 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.CameraManagerImpl.unregisterReceiver(CameraManagerImpl.java:172)
06-21 17:58:58.763 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.names.WebcamNameImpl$ArmableDeviceHelper$3.run(WebcamNameImpl.java:587)
06-21 17:58:58.764 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.system.Tracer.trace(Tracer.java:140)
06-21 17:58:58.764 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.names.WebcamNameImpl$ArmableDeviceHelper.disarmDevice(WebcamNameImpl.java:582)
06-21 17:58:58.764 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.hardware.usb.ArmableUsbDevice.doDisarm(ArmableUsbDevice.java:504)
06-21 17:58:58.764 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.hardware.usb.ArmableUsbDevice$3.run(ArmableUsbDevice.java:478)
06-21 17:58:58.765 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.system.Tracer.trace(Tracer.java:221)
06-21 17:58:58.765 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.hardware.usb.ArmableUsbDevice.disarm(ArmableUsbDevice.java:462)
06-21 17:58:58.765 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at org.firstinspires.ftc.robotcore.internal.camera.names.WebcamNameImpl.disarm(WebcamNameImpl.java:635)
06-21 17:58:58.766 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.ftccommon.FtcEventLoop$DefaultUsbModuleAttachmentHandler.handleUsbModuleAttach(FtcEventLoop.java:543)
06-21 17:58:58.766 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.ftccommon.FtcEventLoop.handleUsbModuleAttach(FtcEventLoop.java:532)
06-21 17:58:58.767 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.ftccommon.FtcEventLoop.processedRecentlyAttachedUsbDevices(FtcEventLoop.java:507)
06-21 17:58:58.767 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.eventloop.EventLoopManager$EventLoopRunnable$1.run(EventLoopManager.java:290)
06-21 17:58:58.767 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool.logThreadLifeCycle(ThreadPool.java:737)
06-21 17:58:58.767 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.eventloop.EventLoopManager$EventLoopRunnable.run(EventLoopManager.java:239)
06-21 17:58:58.767 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.eventloop.EventLoopManager$1.run(EventLoopManager.java:564)
06-21 17:58:58.768 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
06-21 17:58:58.768 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
06-21 17:58:58.768 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at com.qualcomm.robotcore.util.ThreadPool$ThreadFactoryImpl$1.run(ThreadPool.java:793)
06-21 17:58:58.768 10213-10213/com.qualcomm.ftcrobotcontroller E/RobotCore:     at java.lang.Thread.run(Thread.java:818)
06-21 17:58:58.769 10213-10213/com.qualcomm.ftcrobotcontroller E/ThreadPool: *****************************************************************
06-21 17:58:58.769 10213-10213/com.qualcomm.ftcrobotcontroller E/ThreadPool: EventLoop took too long to exit; emergency killing app.
06-21 17:58:58.769 10213-10213/com.qualcomm.ftcrobotcontroller E/ThreadPool: possible infinite loop in user code?
06-21 17:58:58.769 10213-10213/com.qualcomm.ftcrobotcontroller E/ThreadPool: *****************************************************************
06-21 17:58:58.775 10213-10213/com.qualcomm.ftcrobotcontroller I/art: System.exit called, status: -1
06-21 17:58:58.776 10213-10213/com.qualcomm.ftcrobotcontroller I/AndroidRuntime: VM exiting with result code -1, cleanup skipped.
RedfishRobotics commented 6 years ago

@FROGbots-4634 are you using a powered USB hub? The issue may be that the webcam uses too much from the phones USB port. Powered hubs are legal as rule in game manual part one states. My team uses one and hasn't had the issue.

Windwoes commented 6 years ago

@FROGbots-4634 are you using a powered USB hub? The issue may be that the webcam uses too much from the phones USB port. Powered hubs are legal as rule in game manual part one states. My team uses one and hasn't had the issue.

Yes. Also, I have used a USB multimeter to verify the webcam is not pulling any power from the phone.

Windwoes commented 6 years ago

@RedfishRobotics also, even if it was a power problem, the SDK should not be crashing when doing a "restart robot".

RedfishRobotics commented 6 years ago

We did have an issue with the SDK not calling the Webcam class. We had to reinstall and Re-sync the SDK to get the calls to work. That might be part of the issue. Also what code/sample are you using. We use DogeCV and OpenCV, so we have more experience with that; however, we did use the first samples before we got CV working.

Windwoes commented 6 years ago

@RedfishRobotics I think you're misunderstanding the issue. This issue is occurring before user code is even run at all.

RedfishRobotics commented 6 years ago

Yes, I was misunderstanding. We had an issue with the app not detecting the webcam on the phone until we update the phones OS to nougat, 7.1.1. OS. Maybe that will help. In case you don't know how to check, settings>about phone>Android version, 7.1.1. We use Moto G Plays so might be different for other phones