xiaocong / uiautomator

Python wrapper of Android uiautomator test tool.
MIT License
2.04k stars 644 forks source link

the problem of RPC server not started #111

Closed ChenFromNB closed 9 years ago

ChenFromNB commented 9 years ago

Recently I use uiautomator for android automation.It works fine and easy to use :).However, I meet a problem, the RPC server can not started.Here is how it happens: Android devices run without error for about 12 hours, then the problem happens with log:

return self.server.jsonrpc.deviceInfo()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/uiautomator/__init__.py", line 417, in wrapper
server.start(timeout=30)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/uiautomator/__init__.py", line 456, in start
raise IOError("RPC server not started!")
OSError: RPC server not started

Then I try to start automation again, but the RPC server always can not started. Here is the log by logcat of the device:

--------- beginning of /dev/log/main
I/TrafficManageService( 6757): mina mTrafficStatsReceiver onReceive
--------- beginning of /dev/log/system
W/ContextImpl( 6757): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1155 android.content.ContextWrapper.sendBroadcast:365 com.miui.networkassistant.service.tm.TrafficManageService.broadCastDataUsageUpdated:519 com.miui.networkassistant.service.tm.TrafficManageService$4.onReceive:666 android.app.LoadedApk$ReceiverDispatcher$Args.run:761 
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/AndroidRuntime( 7003): 
D/AndroidRuntime( 7003): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 7003): CheckJNI is OFF
D/dalvikvm( 7003): Unable to stat classpath element '/data/app/com.miui.sdk-1.apk'
D/dalvikvm( 7003): Unable to stat classpath element '/data/app/com.miui.sdk-2.apk'
D/dalvikvm( 7003): Unable to stat classpath element '/data/app/com.miui.framework-1.apk'
D/dalvikvm( 7003): Unable to stat classpath element '/data/app/com.miui.framework-2.apk'
D/dalvikvm( 7003): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 7003): Added shared lib libjavacore.so 0x0
D/dalvikvm( 7003): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 7003): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 7003): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
I/dalvikvm( 7003): DexOpt: not all deps represented
E/dalvikvm( 7003): /system/framework/android.test.runner.jar odex has stale dependencies
I/dalvikvm( 7003): DexOpt: not all deps represented
E/dalvikvm( 7003): /system/framework/uiautomator.jar odex has stale dependencies
D/dalvikvm( 7003): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
D/AndroidRuntime( 7003): Calling main entry com.android.commands.uiautomator.Launcher
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
D/dalvikvm( 7003): GC_FOR_ALLOC freed 7261K, 89% free 923K/8192K, paused 25ms, total 32ms
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
W/PushService( 3835): 2015-07-11 18:36:55,353 - [WARN::PushService] - [Thread:1] Service called on timer
I/XiaomiFirewall( 6757): firewall pkgName:com.google.android.gsf, result:0
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
D/dalvikvm( 7003): GC_CONCURRENT freed 1953K, 89% free 951K/8192K, paused 3ms+2ms, total 40ms
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
D/GCM     ( 6065): Connected
D/ConnectivityServiceHSM( 1042): Actual State: DefaultConnectivityState, Current State: DefaultConnectivityState.processMessage what=104
D/ConnectivityServiceHSM( 1042): Actual State: DefaultConnectivityState, Current State: DefaultConnectivityState.processMessage what=5006
D/ConnectivityServiceHSM( 1042): Actual State: DefaultConnectivityState, Current State: DefaultConnectivityState.processMessage what=104
D/ConnectivityServiceHSM( 1042): Actual State: DefaultConnectivityState, Current State: DefaultConnectivityState.processMessage what=5006
D/GCM     ( 6065): Message class fon
D/ConnectivityServiceHSM( 1042): Actual State: DefaultConnectivityState, Current State: DefaultConnectivityState.processMessage what=104
D/ConnectivityServiceHSM( 1042): Actual State: DefaultConnectivityState, Current State: DefaultConnectivityState.processMessage what=5006
D/ConnectivityServiceHSM( 1042): Actual State: DefaultConnectivityState, Current State: DefaultConnectivityState.processMessage what=105
D/ConnectivityServiceHSM( 1042): Actual State: DefaultConnectivityState, Current State: DefaultConnectivityState.processMessage what=5007
D/QcConnectivityService( 1042): handleInetConditionHoldEnd: net=1, condition=100, published condition=0
D/StatusBar.NetworkController( 1121): slot=-10;action=android.net.conn.INET_CONDITION_ACTION
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
D/dalvikvm( 7003): GC_CONCURRENT freed 1990K, 89% free 942K/8192K, paused 2ms+3ms, total 37ms
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
D/dalvikvm( 7003): GC_CONCURRENT freed 1993K, 89% free 948K/8192K, paused 3ms+3ms, total 50ms
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/dalvikvm( 7003): GC_CONCURRENT freed 1988K, 89% free 926K/8192K, paused 3ms+2ms, total 36ms
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [LOWI-SERVER] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/dalvikvm( 7003): GC_CONCURRENT freed 1945K, 89% free 909K/8192K, paused 3ms+2ms, total 26ms
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
W/PushService( 3835): 2015-07-11 18:37:10,357 - [WARN::PushService] - [Thread:312] JOB: check the ping-pong.
W/PushService( 3835): 2015-07-11 18:37:10,359 - [WARN::PushService] - [Thread:312] disconnect 1115474392, 1115535728
W/PushService( 3835): 2015-07-11 18:37:10,364 - [WARN::PushService] - [Thread:312] update the connection status. connected -> disconnected : ERROR_PING_TIMEOUT 
W/PushService( 3835): 2015-07-11 18:37:10,374 - [WARN::PushService] - [Thread:312] schedule reconnect in 60s
W/PushService( 3835): 2015-07-11 18:37:10,378 - [WARN::PushService] - 
W/PushService( 3835): 
W/PushService( 3835): java.net.SocketException: Socket closed
W/PushService( 3835):   at libcore.io.Posix.recvfromBytes(Native Method)
W/PushService( 3835):   at libcore.io.Posix.recvfrom(Posix.java:141)
W/PushService( 3835):   at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164)
W/PushService( 3835):   at libcore.io.IoBridge.recvfrom(IoBridge.java:506)
W/PushService( 3835):   at java.net.PlainSocketImpl.read(PlainSocketImpl.java:489)
W/PushService( 3835):   at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
W/PushService( 3835):   at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:241)
W/PushService( 3835):   at java.io.InputStreamReader.read(InputStreamReader.java:233)
W/PushService( 3835):   at java.io.BufferedReader.read(BufferedReader.java:325)
W/PushService( 3835):   at com.xiaomi.smack.util.ObservableReader.read(ObservableReader.java:43)
W/PushService( 3835):   at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1506)
W/PushService( 3835):   at org.kxml2.io.KXmlParser.peekType(KXmlParser.java:986)
W/PushService( 3835):   at org.kxml2.io.KXmlParser.next(KXmlParser.java:346)
W/PushService( 3835):   at org.kxml2.io.KXmlParser.next(KXmlParser.java:310)
W/PushService( 3835):   at com.xiaomi.smack.PacketReader.parsePackets(PacketReader.java:191)
W/PushService( 3835):   at com.xiaomi.smack.PacketReader.access$000(PacketReader.java:46)
W/PushService( 3835):   at com.xiaomi.smack.PacketReader$1.run(PacketReader.java:71)
W/PushService( 3835): 2015-07-11 18:37:10,393 - [WARN::PushService] - [Thread:312] update the client 5 status. binded->unbind CLOSE ERROR_PING_TIMEOUT null null
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
D/dalvikvm( 7003): GC_CONCURRENT freed 1949K, 89% free 927K/8192K, paused 1ms+3ms, total 30ms
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/dalvikvm( 7003): GC_CONCURRENT freed 1937K, 89% free 918K/8192K, paused 2ms+5ms, total 22ms
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
D/dalvikvm( 7003): GC_CONCURRENT freed 1956K, 89% free 927K/8192K, paused 2ms+15ms, total 34ms
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
D/dalvikvm( 7003): GC_CONCURRENT freed 1912K, 89% free 943K/8192K, paused 6ms+6ms, total 26ms
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30400 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWiFi-PE] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/wpa_supplicant( 1218): wlan0: BSS: Remove id 25 BSSID 14:75:90:29:45:b4 SSID 'TP-LINK_45B4' due to wpa_bss_flush_by_age
D/wpa_supplicant( 1218): CTRL_IFACE monitor send - hexdump(len=40): 2f 64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b 65 74 73 2f 77 70 61 5f 63 74 72 6c ...
D/wpa_supplicant( 1218): wlan0: BSS: Remove id 26 BSSID e0:05:c5:1d:65:f8 SSID 'TP-LINK_1D65F8' due to wpa_bss_flush_by_age
D/wpa_supplicant( 1218): CTRL_IFACE monitor send - hexdump(len=40): 2f 64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b 65 74 73 2f 77 70 61 5f 63 74 72 6c ...
D/wpa_supplicant( 1218): wlan0: BSS: Remove id 23 BSSID e0:05:c5:be:ae:28 SSID 'wcs' due to wpa_bss_flush_by_age
D/wpa_supplicant( 1218): CTRL_IFACE monitor send - hexdump(len=40): 2f 64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b 65 74 73 2f 77 70 61 5f 63 74 72 6c ...
D/wpa_supplicant( 1218): wlan0: BSS: Remove id 24 BSSID c8:3a:35:21:ac:40 SSID 'xiaowangwang' due to wpa_bss_flush_by_age
D/wpa_supplicant( 1218): CTRL_IFACE monitor send - hexdump(len=40): 2f 64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b 65 74 73 2f 77 70 61 5f 63 74 72 6c ...
D/wpa_supplicant( 1218): wlan0: BSS: Remove id 27 BSSID 50:bd:5f:8a:54:6e SSID 'pangpang' due to wpa_bss_flush_by_age
D/wpa_supplicant( 1218): CTRL_IFACE monitor send - hexdump(len=40): 2f 64 61 74 61 2f 6d 69 73 63 2f 77 69 66 69 2f 73 6f 63 6b 65 74 73 2f 77 70 61 5f 63 74 72 6c ...
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XTWWAN-PE] unknown deliver target [OS-Agent]
E/QCALOG  (  379): [MessageQ] ProcessNewMessage: [XT-CS] unknown deliver target [OS-Agent]
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
I/ThermalEngine(  227): Sensor:batt_temp:30500 mC
D/wpa_supplicant( 1218): RX ctrl_iface - hexdump(len=11): 53 49 47 4e 41 4c 5f 50 4f 4c 4c
D/wpa_supplicant( 1218): wlan0: Control interface command 'SIGNAL_POLL'
D/wpa_supplicant( 1218): nl80211: survey data missing!
xiaocong commented 9 years ago

I am not sure the root cause, but you can have a try to clear the dalvik cache directory on device, or perform a factory reset. Hope it can help you out.