mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.64k stars 255 forks source link

`maestro cloud` upload failed due to socket exception #1856

Closed yonaskolb closed 3 weeks ago

yonaskolb commented 1 month ago

Is there an existing issue for this?

Steps to reproduce

Run maestro in Bitrise using the Upload to Maestro Cloud step version 1.4.0 https://github.com/mobile-dev-inc/bitrise-step-maestro-cloud-upload

This has been working fine but has started failing since yesterday

Actual results

Get Upload failed due to socket exception, retrying until it gives up.

Full step output in Bitrise:

+ cd /Users/vagrant/git
+ [[ -z '' ]]
+ echo 'Maestro CLI version not specified, using latest'
Maestro CLI version not specified, using latest
++ curl --version
++ head -n 1
++ awk '{print $2}'
+ curl_version=8.6.0
+ echo 'Current curl version: 8.6.0'
Current curl version: 8.6.0
+ required_version=7.71.0
++ printf '%s\n' 7.71.0 8.6.0
++ sort -V
++ head -n1
+ '[' 7.71.0 = 7.71.0 ']'
+ echo 'version is higher or equal 7.71.0'
version is higher or equal 7.71.0
+ curl --retry 5 --retry-all-errors -Ls https://get.maestro.mobile.dev/
+ bash
* Create distribution directories...
* Downloading...
#=#=#                                                                          

                                                                           1.4%
#############                                                             18.6%
#############################                                             41.3%
##############################################                            63.9%
###########################################################               82.5%
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...
Adding maestro to your PATH in /Users/vagrant/.bash_profile
Adding maestro to your PATH in /Users/vagrant/.zshrc
Installation was successful!
Please open a new terminal OR run the following in the existing one:
    export PATH="$PATH":"$HOME/.maestro/bin"
Then run the following command:
    maestro
Welcome to Maestro!
+ export 'PATH=/Users/vagrant/.bitrise/tools:/opt/homebrew/opt/curl/bin:/Users/vagrant/.asdf/shims:/Users/vagrant/.asdf/bin:/Users/vagrant/.jenv/shims:/Users/vagrant/.pyenv/shims:/Users/vagrant/.local/bin:/Users/vagrant/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/share/g[REDACTED]le-cloud-sdk/bin:/Users/vagrant/.jenv/shims:/Users/vagrant/.pyenv/shims:/Users/vagrant/.local/bin:/Users/vagrant/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/vagrant/go/bin:/Users/vagrant/.pub-cache/bin:/Users/vagrant/fvm/default/bin:/Users/vagrant/bitrise/tools/cmd-bridge/bin/osx:/usr/local/share/android-sdk/ndk-bundle:/usr/local/share/android-sdk/platform-tools:/usr/local/share/android-sdk/cmdline-tools/cmdline-tools/bin:/Users/vagrant/.mint/bin:/Users/vagrant/.jenv/bin:/usr/sbin:/Users/vagrant/go/bin:/Users/vagrant/.pub-cache/bin:/Users/vagrant/fvm/default/bin:/Users/vagrant/bitrise/tools/cmd-bridge/bin/osx:/usr/local/share/android-sdk/ndk-bundle:/usr/local/share/android-sdk/platform-tools:/usr/local/share/android-sdk/cmdline-tools/cmdline-tools/bin:/Users/vagrant/.mint/bin:/Users/vagrant/.jenv/bin:/Users/vagrant/.maestro/bin'
+ PATH='/Users/vagrant/.bitrise/tools:/opt/homebrew/opt/curl/bin:/Users/vagrant/.asdf/shims:/Users/vagrant/.asdf/bin:/Users/vagrant/.jenv/shims:/Users/vagrant/.pyenv/shims:/Users/vagrant/.local/bin:/Users/vagrant/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/share/g[REDACTED]le-cloud-sdk/bin:/Users/vagrant/.jenv/shims:/Users/vagrant/.pyenv/shims:/Users/vagrant/.local/bin:/Users/vagrant/.rbenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/vagrant/go/bin:/Users/vagrant/.pub-cache/bin:/Users/vagrant/fvm/default/bin:/Users/vagrant/bitrise/tools/cmd-bridge/bin/osx:/usr/local/share/android-sdk/ndk-bundle:/usr/local/share/android-sdk/platform-tools:/usr/local/share/android-sdk/cmdline-tools/cmdline-tools/bin:/Users/vagrant/.mint/bin:/Users/vagrant/.jenv/bin:/usr/sbin:/Users/vagrant/go/bin:/Users/vagrant/.pub-cache/bin:/Users/vagrant/fvm/default/bin:/Users/vagrant/bitrise/tools/cmd-bridge/bin/osx:/usr/local/share/android-sdk/ndk-bundle:/usr/local/share/android-sdk/platform-tools:/usr/local/share/android-sdk/cmdline-tools/cmdline-tools/bin:/Users/vagrant/.mint/bin:/Users/vagrant/.jenv/bin:/Users/vagrant/.maestro/bin'
+ EXIT_CODE=0
+ maestro cloud --apiKey [REDACTED] --branch feat/chat-details --repoName [REDACTED]-ios-app --repoOwner [REDACTED]app --name 'feat: chat details
This PR covers:
...SNIP...
' --async --pullRequestId 247 --ios-version 17 -e APP_ID=health.[REDACTED].app /Users/vagrant/deploy/Oog.app Flows
CI detected, analytics was automatically enabled.
To opt out, set MAESTRO_CLI_NO_ANALYTICS environment variable to any value before running Maestro.
Evaluating workspace...
Uploading Flow(s)...
Upload failed due to socket exception, retrying...
Upload failed due to socket exception, retrying...
Upload failed due to socket exception, retrying...
Upload failed due to socket exception
+ EXIT_CODE=1
+ [[ -n '' ]]
+ exit 1

Expected results

Upload completes successfully

About app

Native iOS app

About environment

Logs

Logs ``` ```

Maestro version

Bitrise step logs don't say just "latest version"

How did you install Maestro?

install script (https://get.maestro.mobile.dev)

Anything else?

No response

yonaskolb commented 1 month ago

I can confirm pinning to cli version 1.36.0 fixes the issue. I haven't tested any other higher versions before the latest release

afestein commented 1 month ago

Thanks Yonas, confirming issue can be fixed with CLI version pinned, e.g.:

inputs:
  - maestro_cli_version: 1.36.0
bartekpacia commented 1 month ago

Hey guys, Here's what I know so far:

Any more information that you share will be very useful. Can you confirm it works for you when you run locally? Thanks and sorry.

bartekpacia commented 1 month ago

Please don't comment with "i have the same issue" unless you have some useful context to add. Instead add a 👍 to the OP. Thank you.

SaphiraNgocThuy commented 1 month ago

same issue on CircleCI, maestro version 1.37.4

salemMuhamed commented 1 month ago

If it will help, a minor downgrade from 1.37.4 to 1.37.3 resolved the issue on Bitrise.

inputs:
  - maestro_cli_version: 1.37.3
bartekpacia commented 1 month ago

Please update to v1.37.5 – we fixed a problem that caused "socket exception to be printed" instead of more accourate information. Once you update and encounter this problem, please post them here, along with useful context. This is not a bugfix per se, but should allow us to actually pinpoint the problem.

Him-Sharma commented 1 month ago

@bartekpacia I tried with 1.37.5 and still seeing the same error message and no other stacktrace

+ cd /bitrise/src
+ [[ -z 1.37.5 ]]
+ echo 'Maestro CLI version: 1.37.5'
Maestro CLI version: 1.37.5
+ export MAESTRO_VERSION=1.37.5
+ MAESTRO_VERSION=1.37.5
++ curl --version
++ head -n 1
++ awk '{print $2}'
+ curl_version=7.68.0
+ echo 'Current curl version: 7.68.0'
Current curl version: 7.68.0
+ required_version=7.71.0
++ printf '%s\n' 7.71.0 7.68.0
++ sort -V
++ head -n1
+ '[' 7.68.0 = 7.71.0 ']'
+ echo 'version is lower than 7.71.0'
version is lower than 7.71.0
+ curl --retry 5 -Ls https://get.maestro.mobile.dev/
+ bash
* Create distribution directories...
* Downloading...
#=#=#                                                                         

                                                                           0.0%

#                                                                          2.7%

#############                                                             18.3%

########################                                                  34.1%

###################################                                       49.4%
##############################################                            64.9%
##########################################################                80.7%
#####################################################################     96.3%
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...
Attempt update of interactive bash profile on regular UNIX...
Adding maestro to your PATH in /root/.bashrc
Adding maestro to your PATH in /root/.zshrc
Installation was successful!
Please open a new terminal OR run the following in the existing one:
    export PATH="$PATH":"$HOME/.maestro/bin"
Then run the following command:
    maestro
Welcome to Maestro!
+ export PATH=/root/flutter-sdk/flutter/bin:/root/flutter-sdk/flutter/bin/cache/dart-sdk/bin:/root/flutter-sdk/flutter/.pub-cache/bin:/root/.pub-cache/bin:/root/.bitrise/tools:/root/.asdf/shims:/root/.asdf/bin:/opt/flutter/bin:/usr/local/bin/kotlinc/bin:/bitrise/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/cmdline-tools/latest/bin:/opt/android-sdk-linux/cmdline-tools/7.0/bin:/opt/android-sdk-linux/emulator:/opt/gradle/gradle-8.2.1/bin/:/opt/android-sdk-linux/ndk-bundle:/root/.maestro/bin
+ PATH=/root/flutter-sdk/flutter/bin:/root/flutter-sdk/flutter/bin/cache/dart-sdk/bin:/root/flutter-sdk/flutter/.pub-cache/bin:/root/.pub-cache/bin:/root/.bitrise/tools:/root/.asdf/shims:/root/.asdf/bin:/opt/flutter/bin:/usr/local/bin/kotlinc/bin:/bitrise/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/cmdline-tools/latest/bin:/opt/android-sdk-linux/cmdline-tools/7.0/bin:/opt/android-sdk-linux/emulator:/opt/gradle/gradle-8.2.1/bin/:/opt/android-sdk-linux/ndk-bundle:/root/.maestro/bin
+ EXIT_CODE=0
+ maestro cloud --apiKey [REDACTED] --branch chore/maestro-upload-issue  --name 'testing maestro upload issue' --android-api-level 30 --include-tags android --format junit --output report.xml /test.apk /Users/vagrant/e2e/.maestro
CI detected, analytics was automatically enabled.
To opt out, set MAESTRO_CLI_NO_ANALYTICS environment variable to any value before running Maestro.
Evaluating workspace...
Uploading Flow(s)...
Upload failed due to socket exception, retrying...
Upload failed due to socket exception, retrying...
Upload failed due to socket exception, retrying...
Upload failed due to socket exception
bartekpacia commented 1 month ago

@Him-Sharma Thanks for sharing this. Can you confirm that 1.37.3 works for you?

Him-Sharma commented 1 month ago

@Him-Sharma Thanks for sharing this. Can you confirm that 1.37.3 works for you?

just tested with 1.37.3 and it works fine. trying 1.37.6 now

Him-Sharma commented 1 month ago

@bartekpacia here you go java.nio.file.NoSuchFileException: /root/.maestro/analytics.json at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218) at java.base/java.nio.file.Files.newByteChannel(Files.java:380) at java.base/java.nio.file.Files.newByteChannel(Files.java:432) at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422) at java.base/java.nio.file.Files.newInputStream(Files.java:160) at kotlin.io.path.PathsKtPathReadWriteKt.readText(PathReadWrite.kt:155) at kotlin.io.path.PathsKtPathReadWriteKt.readText$default(PathReadWrite.kt:154) at maestro.cli.analytics.Analytics.getAnalyticsState(Analytics.kt:50) at maestro.cli.analytics.Analytics.getUuid(Analytics.kt:65) at maestro.cli.api.SystemInformationInterceptor.intercept(ApiClient.kt:517) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) at maestro.cli.api.ApiClient.upload(ApiClient.kt:335)

bartekpacia commented 1 month ago

Thanks a lot Himanshu.

Can you show the full command you run?

Him-Sharma commented 1 month ago

Does this help??? I am using the bitrise step to upload to cloud https://github.com/mobile-dev-inc/bitrise-step-maestro-cloud-upload

+ cd /bitrise/src
+ [[ -z '' ]]
+ echo 'Maestro CLI version not specified, using latest'
Maestro CLI version not specified, using latest
++ curl --version
++ head -n 1
++ awk '{print $2}'
+ curl_version=7.68.0
+ echo 'Current curl version: 7.68.0'
Current curl version: 7.68.0
+ required_version=7.71.0
++ printf '%s\n' 7.71.0 7.68.0
++ sort -V
++ head -n1
+ '[' 7.68.0 = 7.71.0 ']'
+ echo 'version is lower than 7.71.0'
version is lower than 7.71.0
+ curl --retry 5 -Ls https://get.maestro.mobile.dev/
+ bash
* Create distribution directories...
* Downloading...
#=#=#                                                                         
##O#- #                                                                       

                                                                           0.3%
######                                                                     9.6%

##################                                                        25.4%
##############################                                            42.1%

#########################################                                 58.2%

#####################################################                     74.9%

#################################################################         90.7%
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...
Attempt update of interactive bash profile on regular UNIX...
Adding maestro to your PATH in /root/.bashrc
Adding maestro to your PATH in /root/.zshrc
Installation was successful!
Please open a new terminal OR run the following in the existing one:
    export PATH="$PATH":"$HOME/.maestro/bin"
Then run the following command:
    maestro
Welcome to Maestro!
+ export PATH=/root/flutter-sdk/flutter/bin:/root/flutter-sdk/flutter/bin/cache/dart-sdk/bin:/root/flutter-sdk/flutter/.pub-cache/bin:/root/.pub-cache/bin:/root/.bitrise/tools:/root/.asdf/shims:/root/.asdf/bin:/opt/flutter/bin:/usr/local/bin/kotlinc/bin:/bitrise/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/cmdline-tools/latest/bin:/opt/android-sdk-linux/cmdline-tools/7.0/bin:/opt/android-sdk-linux/emulator:/opt/gradle/gradle-8.2.1/bin/:/opt/android-sdk-linux/ndk-bundle:/root/.maestro/bin
+ PATH=/root/flutter-sdk/flutter/bin:/root/flutter-sdk/flutter/bin/cache/dart-sdk/bin:/root/flutter-sdk/flutter/.pub-cache/bin:/root/.pub-cache/bin:/root/.bitrise/tools:/root/.asdf/shims:/root/.asdf/bin:/opt/flutter/bin:/usr/local/bin/kotlinc/bin:/bitrise/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/cmdline-tools/latest/bin:/opt/android-sdk-linux/cmdline-tools/7.0/bin:/opt/android-sdk-linux/emulator:/opt/gradle/gradle-8.2.1/bin/:/opt/android-sdk-linux/ndk-bundle:/root/.maestro/bin
+ EXIT_CODE=0
+ maestro cloud --apiKey [REDACTED] --branch master --repoName name --repoOwner name --name 'name' --android-api-level 30 --include-tags android --format junit --output report.xml /bitrise/src/app/build/outputs/apk/name.apk /Users/vagrant/e2e/.maestro
CI detected, analytics was automatically enabled.
To opt out, set MAESTRO_CLI_NO_ANALYTICS environment variable to any value before running Maestro.
Evaluating workspace...
Uploading Flow(s)...
Upload failed due to socket exception, retrying (1/3)...
Upload failed due to socket exception, retrying (2/3)...
Upload failed due to socket exception, retrying (3/3)...
java.nio.file.NoSuchFileException: /root/.maestro/analytics.json
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
    at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:422)
    at java.base/java.nio.file.Files.newInputStream(Files.java:160)
    at kotlin.io.path.PathsKt__PathReadWriteKt.readText(PathReadWrite.kt:155)
    at kotlin.io.path.PathsKt__PathReadWriteKt.readText$default(PathReadWrite.kt:154)
    at maestro.cli.analytics.Analytics.getAnalyticsState(Analytics.kt:50)
    at maestro.cli.analytics.Analytics.getUuid(Analytics.kt:65)
    at maestro.cli.api.SystemInformationInterceptor.intercept(ApiClient.kt:517)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
    at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
    at maestro.cli.api.ApiClient.upload(ApiClient.kt:335)
    at maestro.cli.api.ApiClient.upload$retry(ApiClient.kt:303)
    at maestro.cli.api.ApiClient.upload(ApiClient.kt:337)
    at maestro.cli.api.ApiClient.upload$retry(ApiClient.kt:303)
    at maestro.cli.api.ApiClient.upload(ApiClient.kt:337)
    at maestro.cli.api.ApiClient.upload$retry(ApiClient.kt:303)
    at maestro.cli.api.ApiClient.upload(ApiClient.kt:337)
    at maestro.cli.api.ApiClient.upload$default(ApiClient.kt:233)
    at maestro.cli.cloud.CloudInteractor.upload(CloudInteractor.kt:104)
    at maestro.cli.command.CloudCommand.call(CloudCommand.kt:168)
    at maestro.cli.command.CloudCommand.call(CloudCommand.kt:37)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
    at picocli.CommandLine.access$1200(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
    at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22)
    at picocli.CommandLine.execute(CommandLine.java:2058)
    at maestro.cli.AppKt.main(App.kt:129)
Upload failed due to socket exception
+ EXIT_CODE=1
+ [[ -n report.xml ]]
+ [[ -f report.xml ]]
+ exit 1
exit status 1
bartekpacia commented 1 month ago

Hey all, this should be fixed in 1.37.7.

yonaskolb commented 1 month ago

Can confirm this is fixed in Bitrise when configuring the maestro step to use the latest version (would be good if that step actually printed the version used, but I'm assuming it's 1.37.7). Thank you @bartekpacia 🙏

bartekpacia commented 1 month ago

Gonna close it since we're not seeing reports of this happening anymore on v1.37.7.

Randy705 commented 4 weeks ago

@bartekpacia I was on holiday but for me using Azure pipeline the problem still occurs with version 1.37.7 :(

bartekpacia commented 4 weeks ago

Hey @Randy705, could you tell more? Some error logs?

Randy705 commented 4 weeks ago

@bartekpacia I don't have any specific logging right now but looking at the behavior it does:

  1. Creating remote azure instance
  2. Installing openjdk-17-jdk
  3. Installing Maestro --> newest version
  4. Setting env Paths correctly
  5. Running maestro cloud command
  6. Here it just gets nothing back
  7. Looking at Maestro cloud console - No new run available

I will look into it to get some more logging.

github-actions[bot] commented 3 weeks ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue. Thank you for helping keep us our issue tracker clean!

bartekpacia commented 3 weeks ago

@Randy705, please create a new issue when you're ready :) (and link to this one)