Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resetApp results in an Error since 1.19.x Server Version #648

Closed
TomBAMU opened this issue Dec 29, 2020 · 3 comments · Fixed by #649
Closed

resetApp results in an Error since 1.19.x Server Version #648

TomBAMU opened this issue Dec 29, 2020 · 3 comments · Fixed by #649

Comments

@TomBAMU
Copy link

TomBAMU commented Dec 29, 2020

Recently we updated to Appium 1.19.1 and the possibility to use resetApp with the espresso-driver is not working anymore.
Unfortunately the instrumentation process crashes unexpectedly. I know the fact, that espresso is running in the actual App under Test and therefore the "clean up" is a quite delicate operation.
Nevertheless, the functionality should be there? Or Is this behavior intended ? Or a regression?

Environment

Appium Version: 1.19.1
Android Version: 6.1
Android Java-Client Version: 7.3.0

Appium Server Debug Log

[debug] [W3C (40b33736)] Calling AppiumDriver.execute() with args: ["mobile: shell",[{"command":"appops set com.android.music SYSTEM_ALERT_WINDOW ignore"}],"40b33736-4a26-4cdc-8057-28d5fea536d3"]
[debug] [W3C (40b33736)] Encountered internal error running command: InvalidContextError: The instrumentation process has unexpectedly crashed. Check the logcat output for more details.
[debug] [W3C (40b33736)]     at EspressoDriver.executeCommand (/home/freybergertho/.npm-global/lib/node_modules/appium/node_modules/appium-espresso-driver/lib/driver.js:439:13)
[debug] [W3C (40b33736)]     at AppiumDriver.executeCommand (/home/freybergertho/.npm-global/lib/node_modules/appium/lib/appium.js:542:36)
[debug] [W3C (40b33736)]     at process._tickCallback (internal/process/next_tick.js:68:7)
[HTTP] <-- POST /wd/hub/session/40b33736-4a26-4cdc-8057-28d5fea536d3/execute/sync 400 3 ms - 610
[HTTP] 
[HTTP] --> POST /wd/hub/session/40b33736-4a26-4cdc-8057-28d5fea536d3/appium/app/reset
[HTTP] {}
[debug] [W3C (40b33736)] Calling AppiumDriver.reset() with args: ["40b33736-4a26-4cdc-8057-28d5fea536d3"]
[debug] [W3C (40b33736)] Encountered internal error running command: InvalidContextError: The instrumentation process has unexpectedly crashed. Check the logcat output for more details.
[debug] [W3C (40b33736)]     at EspressoDriver.executeCommand (/home/freybergertho/.npm-global/lib/node_modules/appium/node_modules/appium-espresso-driver/lib/driver.js:439:13)
[debug] [W3C (40b33736)]     at AppiumDriver.executeCommand (/home/freybergertho/.npm-global/lib/node_modules/appium/lib/appium.js:542:36)
[debug] [W3C (40b33736)]     at process._tickCallback (internal/process/next_tick.js:68:7)
[HTTP] <-- POST /wd/hub/session/40b33736-4a26-4cdc-8057-28d5fea536d3/appium/app/reset 400 5 ms - 610
[HTTP] 
[HTTP] --> DELETE /wd/hub/session/40b33736-4a26-4cdc-8057-28d5fea536d3
[HTTP] {}

Logcat output

system_process E/KernelUidCpuTimeReader: failed to remove uid from uid_cputime module
    java.io.FileNotFoundException: /proc/uid_cputime/remove_uid_range: open failed: ENOENT (No such file or directory)
        at libcore.io.IoBridge.open(IoBridge.java:452)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:72)
        at java.io.FileWriter.<init>(FileWriter.java:80)
        at com.android.internal.os.KernelUidCpuTimeReader.removeUid(KernelUidCpuTimeReader.java:157)
        at com.android.internal.os.BatteryStatsImpl.removeUidStatsLocked(BatteryStatsImpl.java:8800)
        at com.android.server.am.BatteryStatsService.removeUid(BatteryStatsService.java:242)
        at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:16562)
        at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:16938)
        at com.android.server.pm.PackageManagerService$8.run(PackageManagerService.java:9423)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.os.HandlerThread.run(HandlerThread.java:61)
        at com.android.server.ServiceThread.run(ServiceThread.java:46)
     Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
        at libcore.io.Posix.open(Native Method)
        at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
        at libcore.io.IoBridge.open(IoBridge.java:438)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:87) 
        at java.io.FileOutputStream.<init>(FileOutputStream.java:72) 
        at java.io.FileWriter.<init>(FileWriter.java:80) 
        at com.android.internal.os.KernelUidCpuTimeReader.removeUid(KernelUidCpuTimeReader.java:157) 
        at com.android.internal.os.BatteryStatsImpl.removeUidStatsLocked(BatteryStatsImpl.java:8800) 
        at com.android.server.am.BatteryStatsService.removeUid(BatteryStatsService.java:242) 
        at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:16562) 
        at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:16938) 
        at com.android.server.pm.PackageManagerService$8.run(PackageManagerService.java:9423) 
        at android.os.Handler.handleCallback(Handler.java:739) 
        at android.os.Handler.dispatchMessage(Handler.java:95) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.os.HandlerThread.run(HandlerThread.java:61) 
        at com.android.server.ServiceThread.run(ServiceThread.java:46) 
@KazuCocoa
Copy link
Member

Thanks for the report.

We expected reset did not work on espresso driver since the hebaviour must have been the same as deleting the session and creating a new session after it. reset could cause unexpected espresso status.

So, the answer is it is regression, but it should raise an unsupported error with an error message...

@TomBAMU
Copy link
Author

TomBAMU commented Dec 30, 2020

Thanks for the reply.

So the fact, that I worked before was a bug than? fix of #451(connected to #314 ) actually made it possible to reset the App, even with the espresso driver. Now I'm a bit confused, sorry.

@KazuCocoa
Copy link
Member

was a bug than?

Yes. We expected the method raised like throw new errors.UnsupportedOperationError('Please quit the session and create a new session in order to close and launch the application under test'); error by #491
But we missed to remove the duplicated method then (#649 )

You can replace your reset scenario by deleting the session and creating a new one. It is the same meaning in Espresso driver as reset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants