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

Appium server crashes and shuts down on first test #20061

Closed
tking16 opened this issue May 2, 2024 · 21 comments
Closed

Appium server crashes and shuts down on first test #20061

tking16 opened this issue May 2, 2024 · 21 comments
Labels
Needs Info typically non-actionable; needs author to respond

Comments

@tking16
Copy link

tking16 commented May 2, 2024

Hi, I have absolutely no idea why this is happening, the appium servers on the node machines connect fine to the hub, but the test will run for about 10 seconds and then close down the Appium server resulting in Unable to execute request: java.net.ConnectException: Connection refused: /127.0.0.1:4723 errors. Can't see much info from the log, just seems to get cut off.

appium.log

node.log

Appium1.yml

server:
  port: 4723
  use-drivers:
    - xcuitest
  default-capabilities:
    appium:wdaLocalPort: 8100
    appium:derivedDataPath: ~/nodeData4
    appium:wdaLaunchTimeout: 720000 # 2 minutes per Simulator
    appium:usePrebuiltWDA: true
    appium:settings[pageSourceExcludedAttributes]: "visible"
    appium:newCommandTimeout: 9999
    appium:mjpegServerPort: 9103
    appium:mjpegScreenshotUrl: "http://127.0.0.1:9103"

Node file

# node4.toml
[server]
port = 5555

[node]
detect-drivers = false
session-timeout=900

[relay]
url = "http://127.0.0.1:4723"
status-endpoint = "/status"
configs = [
    "1", "{\"platformName\": \"iOS\", \"appium:platformVersion\": \"17.0\", \"appium:deviceName\": \"iPhone 15 Pro Max\", \"appium:automationName\": \"XCUITest\"}"
]

Edit: Adding the run command as well

_env/bin/py.test \
    tests \
    --html=${REPORT_HTML_FILENAME} \
    --junitxml=${REPORT_XML_FILENAME} \
    --reruns 1 \
    --variables variables/pytest/ios_test_parallel_caps.json \
    --capability appium:app "${APP_PATH}" \
    --capability appium:isHeadless true \
    --brand "${BRAND}" \
    --appium_port 4444 \
    -k "${TEST_REGEX}" \
    -n ${NODE_COUNT}
    #--appium_wait_for_condition appium \
    #--appium_wait_for_seconds 60 \
@tking16
Copy link
Author

tking16 commented May 2, 2024

Have just uploaded a newer version of the appium log, I had to reload the console to grab more logs

@mykola-mokhnach
Copy link
Collaborator

I don't observe any suspicious traces in the server log. Have you tried to ask at the Selenium hub issues tracker?

@mykola-mokhnach mykola-mokhnach added the Needs Info typically non-actionable; needs author to respond label May 2, 2024
@tking16
Copy link
Author

tking16 commented May 2, 2024

@mykola-mokhnach I did, unfortunately didn't get much help with a resolution, can see here

@tking16
Copy link
Author

tking16 commented May 2, 2024

I may be wrong, but seems as soon as it encounters a failure, instead of quitting the app and starting a new test it will just end the entire server instance. I tried to debug with telnet and the server seems to have shut off there too

@mykola-mokhnach
Copy link
Collaborator

As @diemol mentioned in the issue report above the exception means the server just stops responding to network requests.
I cannot see any hints in the server log above. Try to collect the Appium's node.js process output on that server - maybe it contains some more details or a stack trace.

@tking16
Copy link
Author

tking16 commented May 2, 2024

Try to collect the Appium's node.js process output on that server - maybe it contains some more details or a stack trace.

Will do, could you please advise on how I can do this?

@mykola-mokhnach
Copy link
Collaborator

Unfortunately I cannot help there. It highly depends on how the server is configured. Maybe hire a consultant to help you with that

@tking16
Copy link
Author

tking16 commented May 2, 2024

I've added --long-stacktrace=true to the server command, will share here once it fails and see if we can find anything else

@tking16
Copy link
Author

tking16 commented May 3, 2024

error_log.log
That managed to give a bit more info, I'm still confused as to why. Next steps I'll try are trying the nightly version of selenium server, as I'm on an old version due to this bug

EDIT: Just saw this in the trace 🤔

2024-05-03 09:10:08:365 [Xcode] 2024-05-03 10:10:08.338669+0100 WebDriverAgentRunner-Runner[57142:3015952] Error Domain=com.facebook.WebDriverAgent Code=1 "Cannot take a screenshot within 20000 ms timeout" UserInfo={NSLocalizedDescription=Cannot take a screenshot within 20000 ms timeout}

Maybe I didn't configure the mjpeg capabilities properly?

@mykola-mokhnach
Copy link
Collaborator

2024-05-03 09:10:08:373 uncaughtException: write EPIPE
Error: write EPIPE

This error means that the server logging lib (winston) was not able to write its logs into one of the requested destinations. Make sure all log destinations are writeable while the server is running.

@tking16
Copy link
Author

tking16 commented May 3, 2024

Make sure all log destinations are writeable while the server is running.

Don't know how to do that, but wouldn't Winston be failing because the server is shutting down? So there would technically be no way to know what went wrong

@mykola-mokhnach
Copy link
Collaborator

Don't know how to do that, but wouldn't Winston be failing because the server is shutting down

I am not sure what exactly you mean by that. Winston allows to forward logs to one or more pipes. These could be files, consoles or TCP streams. If any of these streams is unsuspectedly closed during the lifecycle of the node server then the EPIPE exception is triggered

@alokkr016
Copy link

alokkr016 commented May 7, 2024

I am also facing the same issue, only when I am running the grid and the server programatically using shell script.
image

@mykola-mokhnach
Copy link
Collaborator

@alokkr016 Your issue is related to SeleniumHQ/selenium#13481

@alokkr016
Copy link

I am facing the same exception when I am using the selenium-server-4.13.0.jar
Unable to execute request: java.net.ConnectException: Connection refused: /127.0.0.1:4723
but when I am using the selenium-server-4.21.0-SNAPSHOT.jar then I am getting the:
java.io.UncheckedIOException: java.io.IOException: HTTP/1.1 header parser received no bytes

@diemol
Copy link
Contributor

diemol commented May 7, 2024

@alokkr016 please create an issue in the Selenium repo with the details when you use the snapshot jar.

@alokkr016
Copy link

Could you please tell me why I encounter these exceptions when I run the grid and Appium server programmatically, but not when I run them manually?

@diemol
Copy link
Contributor

diemol commented May 7, 2024

@alokkr016, what you are commenting is not related to this issue; please create an issue as I mentioned above. This will help the Appium maintainers focus on what they need to check.

@tking16
Copy link
Author

tking16 commented May 7, 2024

@alokkr016 Please let me know when you create that issue so I can track also, as I see similar problems - it works for me locally but when running through Github Actions I get all the errors

@alokkr016
Copy link

SeleniumHQ/selenium#13913

@mykola-mokhnach
Copy link
Collaborator

Closed as not an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Info typically non-actionable; needs author to respond
Projects
None yet
Development

No branches or pull requests

4 participants