Skip to content

Conversation

@radekdoulik
Copy link
Member

  • so that we avoid issue like this (from Jenkins log):

      Task Adb
        Arguments: -s emulator-5570  uninstall "Mono.Android_Tests"
      Tool /Users/builder/android-toolchain/sdk/platform-tools/adb execution started with arguments: -s emulator-5570  uninstall "Mono.Android_Tests"
      Environment variables being passed to the tool:
      Error: Could not access the Package Manager.  Is the system running?
    

@jonpryor
Copy link
Contributor

jonpryor commented Jun 1, 2017

from Jenkins log

Which Jenkins log? Please link. ;-)

This isn't (shouldn't be?) necessary and will instead result in different errors.

Rephrased: we already wait for device boot to complete:

    <Adb
        Condition=" '$(_ValidAdbTarget)' != 'True' "
        Arguments="$(_AdbTarget) wait-for-device"

adb wait-for-device is supposed to wait for the device to finish booting, before we send any other requests.

What is probably happening is yet another variation on #591: the emulator on the previous run never exited, so there's a "zombie" emulator running around. This can be verified by looking at the <CheckAdbTarget/> output of the Jenkins log: was there an already attached Android target?

If there was an already attached Android target -- as was the case in #591 -- then it's in a "zombie" state, which would explain why the adb uninstall is failing (with the same error, no less!). In which case adding:

adb shell 'while [ &quot;`getprop sys.boot_completed`&quot; != &quot;1&quot; ]; do echo Waiting for device to fully boot; sleep 1; done'

will turn a current failure scenario into a timeout scenario, as it takes 10 hours for a PR build to complete...

This would not be an improvement. ;-)

If instead there is not an attached Android target -- meaning #591 does not apply -- and there is no zombie emulator running around, then we have to start fearing that adb wait-for-device no longer works -- which is a horrifying thought -- and then come up with a workaround.

First, though, we need to determine whether we're dealing with a zombie emulator or not.

@radekdoulik
Copy link
Member Author

Unfortunately adb wait-for-device is not enough. It just waits until the device appears, but doesn't wait for boot to complete. I think it never worked differently. We already used sys.boot_completed property before, in monodroid emulator ruby script.

I think it is not zombie emulator case. Here's the part of the log.

        Using task CheckAdbTarget from Xamarin.Android.Tools.BootstrapTasks.CheckAdbTarget, Xamarin.Android.Tools.BootstrapTasks, Version=1.0.6

        Task CheckAdbTarget
          AdbTarget: 
          SdkVersion: 
        Tool /Users/builder/android-toolchain/sdk/platform-tools/adb execution started with arguments:  shell getprop ro.build.version.sdk 
        Environment variables being passed to the tool:
        error: no devices/emulators found
        Tool /Users/builder/android-toolchain/sdk/platform-tools/adb execution finished.
          [Output] AdbTarget: 
          [Output] IsValidTarget: False
Done executing task "CheckAdbTarget"

Here is the link to the latest Jenkins log https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/417/consoleFull

It happens in every log I checked. The fix in this PR solves the issue. We have similar loop in monodroid ruby script.

I can add a counter so that we timeout, say after a minute or so. Sounds good?

@jonpryor
Copy link
Contributor

jonpryor commented Jun 1, 2017

I can add a counter so that we timeout, say after a minute or so. Sounds good?

Yes, that sounds wonderful. Please do so.

 - so that we avoid issue like this (from Jenkins log):

         Task Adb
           Arguments: -s emulator-5570  uninstall "Mono.Android_Tests"
         Tool /Users/builder/android-toolchain/sdk/platform-tools/adb execution started with arguments: -s emulator-5570  uninstall "Mono.Android_Tests"
         Environment variables being passed to the tool:
         Error: Could not access the Package Manager.  Is the system running?
@radekdoulik radekdoulik force-pushed the pr-wait-for-emulator-boot-finished branch from a453c32 to 23e24e8 Compare June 2, 2017 13:42
@jonpryor jonpryor merged commit bc6440b into dotnet:master Jun 2, 2017
jonpryor pushed a commit to jonpryor/xamarin-android that referenced this pull request Jun 5, 2017
- so that we avoid issue like this (from Jenkins log):

         Task Adb
           Arguments: -s emulator-5570  uninstall "Mono.Android_Tests"
         Tool /Users/builder/android-toolchain/sdk/platform-tools/adb execution started with arguments: -s emulator-5570  uninstall "Mono.Android_Tests"
         Environment variables being passed to the tool:
         Error: Could not access the Package Manager.  Is the system running?
jonpryor pushed a commit that referenced this pull request Jun 6, 2017
- so that we avoid issue like this (from Jenkins log):

         Task Adb
           Arguments: -s emulator-5570  uninstall "Mono.Android_Tests"
         Tool /Users/builder/android-toolchain/sdk/platform-tools/adb execution started with arguments: -s emulator-5570  uninstall "Mono.Android_Tests"
         Environment variables being passed to the tool:
         Error: Could not access the Package Manager.  Is the system running?
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants