rosjava / android_remocons

Android based remote controllers for 1-1 robot pairing and multi-robot concerts.
21 stars 28 forks source link

robot_remocon: remocon crashes when the paired app_manager has been shut down #27

Closed bit-pirate closed 11 years ago

bit-pirate commented 11 years ago

Would be nice if this situation could be handle more nicely, e.g. throw and catch an exception and return to master chooser screen.

stonier commented 11 years ago

Backtrace:

I/WindowManager(  369): Screen frozen for +248ms due to Window{4221dc68 u0 com.github.ros_java.android_remocons.robot_remocon/com.github.ros_java.android_remocons.robot_remocon.RobotRemocon}
I/Registrar( 5175): Unregistering subscriber: Subscriber<Topic<TopicIdentifier</TurtleBot58319cbabc4940e980a1a08b0e162844/application/scan>, TopicDescription<sensor_msgs/LaserScan, 90c7ef2dc6895d81024acba2ac42f369>>>
I/Registrar( 5175): Unregistering publisher: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</android/map_view, http://192.168.10.187:56195/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>
I/Registrar( 5175): Unregistering subscriber: Subscriber<Topic<TopicIdentifier</tf>, TopicDescription<tf/tfMessage, 94810edda583a504dfda3829e70d7eec>>>
I/Registrar( 7159): MasterXmlRpcEndpoint URI: http://192.168.10.123:11311/
I/Registrar( 7159): Registering publisher: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</pairingApplicationNamePublisher, http://192.168.10.187:38337/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>
I/Registrar( 7159): Registering publisher: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</robotNameResolver, http://192.168.10.187:36089/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>
E/DefaultNodeMainExecutor( 7159): Node error.
E/DefaultNodeMainExecutor( 7159): java.lang.RuntimeException: java.net.ConnectException: failed to connect to /192.168.10.123 (port 11311) after 60000ms: isConnected failed: ECONNREFUSED (Connection refused)
E/DefaultNodeMainExecutor( 7159):       at org.ros.internal.node.xmlrpc.XmlRpcClientFactory$1.invoke(XmlRpcClientFactory.java:157)
E/DefaultNodeMainExecutor( 7159):       at $Proxy0.hasParam(Native Method)
E/DefaultNodeMainExecutor( 7159):       at org.ros.internal.node.client.ParameterClient.hasParam(ParameterClient.java:116)
E/DefaultNodeMainExecutor( 7159):       at org.ros.internal.node.parameter.DefaultParameterTree.has(DefaultParameterTree.java:66)
E/DefaultNodeMainExecutor( 7159):       at org.ros.internal.node.DefaultNode.start(DefaultNode.java:196)
E/DefaultNodeMainExecutor( 7159):       at org.ros.internal.node.DefaultNode.access$000(DefaultNode.java:85)
E/DefaultNodeMainExecutor( 7159):       at org.ros.internal.node.DefaultNode$1.run(DefaultNode.java:173)
E/DefaultNodeMainExecutor( 7159):       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
E/DefaultNodeMainExecutor( 7159):       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
E/DefaultNodeMainExecutor( 7159):       at java.lang.Thread.run(Thread.java:841)
E/DefaultNodeMainExecutor( 7159): Caused by: java.net.ConnectException: failed to connect to /192.168.10.123 (port 11311) after 60000ms: isConnected failed: ECONNREFUSED (Connection refused)
E/DefaultNodeMainExecutor( 7159):       at libcore.io.IoBridge.isConnected(IoBridge.java:223)
E/DefaultNodeMainExecutor( 7159):       at libcore.io.IoBridge.connectErrno(IoBridge.java:161)
E/DefaultNodeMainExecutor( 7159):       at libcore.io.IoBridge.connect(IoBridge.java:112)
E/DefaultNodeMainExecutor( 7159):       at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
E/DefaultNodeMainExecutor( 7159):       at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
E/DefaultNodeMainExecutor( 7159):       at java.net.Socket.connect(Socket.java:842)
E/DefaultNodeMainExecutor( 7159):       at java.lang.reflect.Method.invokeNative(Native Method)
E/DefaultNodeMainExecutor( 7159):       at java.lang.reflect.Method.invoke(Method.java:525)
E/DefaultNodeMainExecutor( 7159):       at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
E/DefaultNodeMainExecutor( 7159):       at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125)
E/DefaultNodeMainExecutor( 7159):       at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
E/DefaultNodeMainExecutor( 7159):       at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
E/DefaultNodeMainExecutor( 7159):       at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
E/DefaultNodeMainExecutor( 7159):       at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
E/DefaultNodeMainExecutor( 7159):       at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
E/DefaultNodeMainExecutor( 7159):       at org.apache.xmlrpc.client.XmlRpcCommonsTransport.writeRequest(XmlRpcCommonsTransport.java:227)
E/DefaultNodeMainExecutor( 7159):       at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:151)
E/DefaultNodeMainExecutor( 7159):       at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
E/DefaultNodeMainExecutor( 7159):       at org.apache.xmlrpc.client.XmlRpcClientWorker$1.run(XmlRpcClientWorker.java:80)
E/DefaultNodeMainExecutor( 7159):       ... 1 more
E/DefaultNodeMainExecutor( 7159): Caused by: libcore.io.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused)
E/DefaultNodeMainExecutor( 7159):       at libcore.io.IoBridge.isConnected(IoBridge.java:208)
E/DefaultNodeMainExecutor( 7159):       ... 19 more
E/Registrar( 7159): Exception caught while communicating with master.
stonier commented 11 years ago

Also implemented uninvitation handling when returning to the robot master chooser in 88f639ec5f277c3cbc22182763a5f1ce949e6ab7 and https://github.com/ros-java/android_apps/commit/620d832fa10b7b6e9a707c8f46edbcee5b11f694.

stonier commented 11 years ago

Could be nicer and have everything return gracefully to the robot master chooser, but requires a complete change in the way it does error handling at that level (currently all errors kill the program with a nice error dialog).