Skip to content

ERROR: Offending XML and Alarm Clock #81

Closed
haradreborn opened this Issue Jun 2, 2014 · 5 comments

2 participants

@haradreborn

Hi, I have a script with infinity loop that runs simple 5 steps test with AVC. Every time after an hour or two it stops with an error:

--------------------------------------
          __    __    __    __            
         /  \  /  \  /  \  /  \           
________/  __\/  __\/  __\/  __\__________
_______/  /__/  /__/  /__/  /_____________
       | / \   / \   / \   / \   \___     
       |/   \_/   \_/   \_/   \    o \    
                               \_____/--< 
CONFIG: 1401701338
DATETIME: 2014-06-02 13:28:58
start: 1401701338000
ERROR: timed out
ERROR: Offending XML:
u'<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\' ?><hierarchy rotation="0"><node index="0" text="" resource-id="" class="android.widget.FrameLayout" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1920]"><node index="0" text="" resource-id="" class="android.widget.LinearLayout" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1920]"><node index="0" text="" resource-id="android:id/content" class="android.widget.FrameLayout" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,0][1080,1920]"><node index="0" text="" resource-id="com.sec.android.app.launcher:id/animation_layer" class="android.widget.FrameLayout" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,75][1080,1920]"><node index="1" text="" resource-id="com.sec.android.app.launcher:id/home_view" class="android.widget.FrameLayout" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,75][1080,1920]"><node index="0" text="" resource-id="com.sec.android.app.launcher:id/home_container" class="android.widget.FrameLayout" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,75][1080,1920]"><node index="0" text="" resource-id="" class="android.widget.FrameLayout" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,75][1080,1920]" /><node index="1" text="" resource-id="com.sec.android.app.launcher:id/workspace" class="android.view.View" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="true" long-clickable="false" password="false" selected="false" bounds="[0,75][1080,1920]"><node index="0" text="" resource-id="" class="android.view.View" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="true" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="true" password="false" selected="false" bounds="[0,70][1080,1424]"><node index="0" text="" resource-id="" class="android.view.View" package="com.sec.android.app.launcher" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[14,90][1067,1404]"><node index="0" text="" resource-id="" class="android.view.View" package="com.sec.android.app.launcher" content-desc="Weather" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="true" password="false" selected="false" bounds="[14,90][1067,738]" /><node index="1" text="" resource-id="" class="android.appwidget.AppWidgetHostView" package="com.sec.android.app.launcher" content-desc="Google Search" checkable="false" checked="false" click'
Traceback (most recent call last):
  File "satest.py", line 28, in <module>
    if (simple.unlock() == True):
  File "/home/adminuser/lampstack-5.4.26-0/apache2/htdocs/ANDROID/simple.py", line 93, in unlock
    vc = ViewClient(*ViewClient.connectToDeviceOrExit())
  File "/usr/local/lib/python2.7/dist-packages/androidviewclient-6.0.0-py2.7.egg/com/dtmilano/android/viewclient.py", line 1286, in __init__
    self.dump()
  File "/usr/local/lib/python2.7/dist-packages/androidviewclient-6.0.0-py2.7.egg/com/dtmilano/android/viewclient.py", line 1894, in dump
    self.setViewsFromUiAutomatorDump(received)
  File "/usr/local/lib/python2.7/dist-packages/androidviewclient-6.0.0-py2.7.egg/com/dtmilano/android/viewclient.py", line 1621, in setViewsFromUiAutomatorDump
    self.__parseTreeFromUiAutomatorDump(received)
  File "/usr/local/lib/python2.7/dist-packages/androidviewclient-6.0.0-py2.7.egg/com/dtmilano/android/viewclient.py", line 1776, in __parseTreeFromUiAutomatorDump
    self.root = parser.Parse(receivedXml)
  File "/usr/local/lib/python2.7/dist-packages/androidviewclient-6.0.0-py2.7.egg/com/dtmilano/android/viewclient.py", line 1081, in Parse
    raise RuntimeError(ex)
RuntimeError: unclosed token: line 1, column 3906
sleep
parser: 1401701338000
Traceback (most recent call last):
  File "parser.py", line 23, in <module>
    appname = lines[int(integr) - 1]
NameError: name 'integr' is not defined
lines: 1401701338000
parser: 1401701338000
--------------------------------------
          __    __    __    __            
         /  \  /  \  /  \  /  \           
________/  __\/  __\/  __\/  __\__________
_______/  /__/  /__/  /__/  /_____________
       | / \   / \   / \   / \   \___     
       |/   \_/   \_/   \_/   \    o \    
                               \_____/--< 
CONFIG: 1401701365
DATETIME: 2014-06-02 13:29:25
start: 1401701365000
Alarm clock
sleep
parser: 1401701365000
lines: 1401701365000
parser: 1401701365000
Traceback (most recent call last):
  File "parser.py", line 23, in <module>
    appname = lines[int(integr) - 1]
NameError: name 'integr' is not defined
--------------------------------------
          __    __    __    __            
         /  \  /  \  /  \  /  \           
________/  __\/  __\/  __\/  __\__________
_______/  /__/  /__/  /__/  /_____________
       | / \   / \   / \   / \   \___     
       |/   \_/   \_/   \_/   \    o \    
                               \_____/--< 
CONFIG: 1401701387
DATETIME: 2014-06-02 13:29:47
start: 1401701387000
Alarm clock
sleep
parser: 1401701387000
Traceback (most recent call last):
  File "parser.py", line 23, in <module>
    appname = lines[int(integr) - 1]
NameError: name 'integr' is not defined
lines: 1401701387000
parser: 1401701387000```

___________________________________


and each next run have a message 'AlarmClock'. How can I fix this issue? 

p.s. 'abd devices' command works correct, but adb is freeze on 'adb reboot'. 
@dtmilano
Owner
dtmilano commented Jun 3, 2014

You didn't include the script so it's difficult to tell what's happening. On the other hand, why the error is printing the culebra which is in a docstring?

@haradreborn

culebra print is a part of my own script, that call 'os.system('python satest.py > _LOGS/launch_log' + start + '.txt')'
here is my unlock part:

def unlock():
    device, serialno = ViewClient.connectToDeviceOrExit(verbose=False)
    print("UNLOCK: init device")
    device.wake()
    print("UNLOCK: press home")
    device.press('KEYCODE_HOME')
    vc = ViewClient(*ViewClient.connectToDeviceOrExit())
    apps = vc.findViewWithText('Apps')
    start = vc.findViewById('com.android.keyguard:id/keyguard_unlock_view_help_text')
    stop = vc.findViewById('com.android.keyguard:id/keyguard_message_area')
    if (apps is None):
        device.drag((start.getX(), start.getY()), (stop.getX(), stop.getY()), 500)
        print ("UNLOCK: drug from object - " + start.__tinyStr__() + " to - " + stop.__tinyStr__())
    else:
        print("UNLOCK: device already unlocked, button apps exists - " + apps.__tinyStr__())
    print("UNLOCK: press home")
    device.press('KEYCODE_HOME')
    if (verify_view('Apps', 0.1, 4) == True):
        STATE.append(1)
        return True
    else:
        STATE.append(2)
        return False

As I understand, adb can cause that issue, because when it freezes, it starts to create a lot of processes, so I can see 50+ procesess with 'pidof adb', and 5037 port become ESTABLISHMENT. I solved this by 'adb kill/start-server' on each test run.

@dtmilano
Owner
@haradreborn

I move connectToDeviceOrExit() to the separate method, and test it again - an issue is still there, but without an xml error at this time. I have an 'ERROR: timed out' and 'Alarm clock ' messages

start: 1401863215000
ERROR: timed out
sleep
Alarm clock
parser: 1401863215000
@haradreborn

And also I got another error:

start: 1401884242000
Traceback (most recent call last):
  File "satest.py", line 58, in <module>
    simple.error_watcher()
  File "/home/adminuser/lampstack-5.4.26-0/apache2/htdocs/ANDROID/simple.py", line 200, in error_watcher
    device.takeSnapshot().save('_SHOTS/scr' + logname + '.png', 'PNG')
  File "/usr/local/lib/python2.7/dist-packages/androidviewclient-6.0.0-py2.7.egg/com/dtmilano/android/adb/adbclient.py", line 416, in takeSnapshot
    received = self.__receive(size)
  File "/usr/local/lib/python2.7/dist-packages/androidviewclient-6.0.0-py2.7.egg/com/dtmilano/android/adb/adbclient.py", line 172, in __receive
    chunk = self.socket.recv(min((nob - nr), 4096))
socket.timeout: timed out
sleep

Here is my error_watcher method:

def error_watcher():
    print ("ERROR: capturing screenshot")
    if (verify_view('Unable to connect to the network. Check your network settings and try again.', 0, 2) == True):
        print ("ERROR: Unable to connect to the network")
        device.takeSnapshot().save('_SHOTS/scr' + logname + '.png', 'PNG')
        ISSUE.append(3)
    elif (verify_view('Network unavailable', 0, 2) == True):
        print ("ERROR: Unable to resolve host")
        device.takeSnapshot().save('_SHOTS/scr' + logname + '.png', 'PNG')
        ISSUE.append(4)
    else:
        print ("ERROR: UNKNOWN")
        device.takeSnapshot().save('_SHOTS/scr' + logname + '.png', 'PNG')
        ISSUE.append(2)

and verify_view:

def verify_view(view, delay, it):
    start = datetime.datetime.now()
    s = 0
    for counter in range(1,it):
        vc = ViewClient(*ViewClient.connectToDeviceOrExit())
        view_object = vc.findViewWithText(view)
        if (view_object is None):
            print("VERIFY: view - " + view + " not found")
            s = 2
            time.sleep(delay)
        else:
            print("VERIFY: view - " + view + " exists")
            s = 1
            break
    stop = datetime.datetime.now()
    global rest
    rest = stop - start
    print("VERIFY: verification time is: " + str(rest) + " seconds")
    if (s == 0):
        print("VERIFY: TEST ERROR, debug param 's' ==  " + str(s))
        return False
    if (s == 1):
        print("VERIFY: verification finished successfully, text - '" + view + "' was found")
        return True
    else:
        print("VERIFY: verification failed, there are no text - '" + view + "'")
        return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.