selenium icon indicating copy to clipboard operation
selenium copied to clipboard

[🐛 Bug]: Node can't connect to Grid hub from version 4.14.0 (Error checking service status http://localhost:4723/status)

Open VitaliiPivtorak opened this issue 2 years ago • 13 comments

What happened?

From version 4.14.0 node can't connect to hub ( checked on 4.10, 4.13 ,4.14.0, 4.14.1, 4.16.1, selenium-server-4.17.0-SNAPSHOT). it works on 4.13 and below.

from browser run link "http://localhost:4723/status"- {"value":{"ready":true,"message":"The server is ready to accept new connections","build":{"version":"2.4.1"}}}

node window result: .@ Grid % java -jar selenium-server-4.16.1.jar node --config node4.toml 15:48:48.216 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding 15:48:48.220 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing 15:48:48.268 INFO [UnboundZmqEventBus.] - Connecting to tcp://0.0.0.0:4442 and tcp://0.0.0.0:4443 15:48:48.289 INFO [UnboundZmqEventBus.] - Sockets created 15:48:49.295 INFO [UnboundZmqEventBus.] - Event bus ready 15:48:49.393 INFO [NodeServer.createHandlers] - Reporting self as: http://192.168.1.144:5557 15:48:49.403 INFO [NodeOptions.getSessionFactories] - Detected 10 available processors 15:48:49.411 INFO [RelayOptions.getSessionFactories] - Adding relay configs for http://localhost:4723 15:48:49.415 INFO [RelayOptions.lambda$getSessionFactories$1] - Mapping Capabilities {appium:automationName: UiAutomator2, appium:deviceName: Pixar 5а, appium:platformVersion: 13, platformName: ANDROID}, 1 times 15:48:49.415 INFO [RelayOptions.lambda$getSessionFactories$1] - Mapping Capabilities {appium:automationName: UiAutomator2, appium:deviceName: Pixar 4, appium:platformVersion: 13, platformName: ANDROID}, 1 times 15:48:49.437 INFO [Node.] - Binding additional locator mechanisms: relative 15:48:49.509 INFO [NodeServer$1.start] - Starting registration process for Node http://192.168.1.144:5557 15:48:49.510 INFO [NodeServer.execute] - Started Selenium node 4.16.1 (revision 9b4c83354e): http://192.168.1.144:5557 15:48:49.620 WARN [RelaySessionFactory.isServiceUp] - Error checking service status http://localhost:4723/status. java.io.IOException: HTTP/1.1 header parser received no bytes 15:48:49.621 ERROR [NodeServer$1.lambda$start$1] - Node is not alive: http://192.168.1.144:5557 is DOWN

How can we reproduce the issue?

java version "21.0.2" (same with "20.0.2")
grid - 4.16.1 (also checked selenium-server-4.17.0-SNAPSHOT, and 4.15) 
Appium v2.4.1

1. Run hub "sudo java -jar selenium-server-4.16.1.jar hub" 
2. Run node "java -jar selenium-server-4.16.1.jar node --config node4.toml"


# node4.toml
[server]
port = 5557
[node]
detect-drivers = false

[relay]
# Default Appium/Cloud server endpoint
url = "http://localhost:4723"
status-endpoint = "/status"
configs = ["1", "{\"platformName\": \"Android\", \"appium:platformVersion\": \"13\", \"appium:deviceName\": \"Pixar 5а\", \"appium:automationName\": \"UiAutomator2\"}",
"1", "{\"platformName\": \"Android\", \"appium:platformVersion\": \"13\", \"appium:deviceName\": \"Pixar 4\", \"appium:automationName\": \"UiAutomator2\"}"]

Relevant log output

____._____@_________ Grid % java -jar selenium-server-4.16.1.jar node --config node4.toml
15:48:48.216 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
15:48:48.220 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
15:48:48.268 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://0.0.0.0:4442 and tcp://0.0.0.0:4443
15:48:48.289 INFO [UnboundZmqEventBus.<init>] - Sockets created
15:48:49.295 INFO [UnboundZmqEventBus.<init>] - Event bus ready
15:48:49.393 INFO [NodeServer.createHandlers] - Reporting self as: http://192.168.1.144:5557
15:48:49.403 INFO [NodeOptions.getSessionFactories] - Detected 10 available processors
15:48:49.411 INFO [RelayOptions.getSessionFactories] - Adding relay configs for http://localhost:4723
15:48:49.415 INFO [RelayOptions.lambda$getSessionFactories$1] - Mapping Capabilities {appium:automationName: UiAutomator2, appium:deviceName: Pixar 5а, appium:platformVersion: 13, platformName: ANDROID}, 1 times
15:48:49.415 INFO [RelayOptions.lambda$getSessionFactories$1] - Mapping Capabilities {appium:automationName: UiAutomator2, appium:deviceName: Pixar 4, appium:platformVersion: 13, platformName: ANDROID}, 1 times
15:48:49.437 INFO [Node.<init>] - Binding additional locator mechanisms: relative
15:48:49.509 INFO [NodeServer$1.start] - Starting registration process for Node http://192.168.1.144:5557
15:48:49.510 INFO [NodeServer.execute] - Started Selenium node 4.16.1 (revision 9b4c83354e): http://192.168.1.144:5557
15:48:49.620 WARN [RelaySessionFactory.isServiceUp] - Error checking service status http://localhost:4723/status. java.io.IOException: HTTP/1.1 header parser received no bytes
15:48:49.621 ERROR [NodeServer$1.lambda$start$1] - Node is not alive: http://192.168.1.144:5557 is DOWN

Operating System

Mac os 14.2.1

Selenium version

4.16.1

What are the browser(s) and version(s) where you see this issue?

appium

What are the browser driver(s) and version(s) where you see this issue?

2.4.1

Are you using Selenium Grid?

4.16.1

VitaliiPivtorak avatar Jan 22 '24 13:01 VitaliiPivtorak

@VitaliiPivtorak, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] avatar Jan 22 '24 13:01 github-actions[bot]

Why is http://localhost:4723/ returning that error?

diemol avatar Jan 23 '24 08:01 diemol

@VitaliiPivtorak can you please check that?

diemol avatar Jan 23 '24 08:01 diemol

Why is http://localhost:4723/ returning that error?

I am running hub and node on same Mac and use url = "http://localhost:4723" in toml file. Without any changes it works on version 4.13.0

VitaliiPivtorak avatar Jan 23 '24 10:01 VitaliiPivtorak

@VitaliiPivtorak can you please check that?

I have checked new version 4.17.0, and replace localhost with ip address in toml file problem the same: @ Grid % java -jar selenium-server-4.17.0.jar node --config node4.toml 12:58:58.609 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding 12:58:58.612 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing 12:58:58.663 INFO [UnboundZmqEventBus.] - Connecting to tcp://0.0.0.0:4442 and tcp://0.0.0.0:4443 12:58:58.682 INFO [UnboundZmqEventBus.] - Sockets created 12:58:59.684 INFO [UnboundZmqEventBus.] - Event bus ready 12:58:59.779 INFO [NodeServer.createHandlers] - Reporting self as: http://192.168.1.144:5557 12:58:59.788 INFO [NodeOptions.getSessionFactories] - Detected 10 available processors 12:58:59.798 INFO [RelayOptions.getSessionFactories] - Adding relay configs for http://192.168.1.144:4723 12:58:59.801 INFO [RelayOptions.lambda$getSessionFactories$1] - Mapping Capabilities {appium:automationName: UiAutomator2, appium:deviceName: Pixar 5а, appium:platformVersion: 13, platformName: ANDROID}, 1 times 12:58:59.801 INFO [RelayOptions.lambda$getSessionFactories$1] - Mapping Capabilities {appium:automationName: UiAutomator2, appium:deviceName: Pixar 4, appium:platformVersion: 13, platformName: ANDROID}, 1 times 12:58:59.822 INFO [Node.] - Binding additional locator mechanisms: relative 12:58:59.890 INFO [NodeServer$1.start] - Starting registration process for Node http://192.168.1.144:5557 12:58:59.891 INFO [NodeServer.execute] - Started Selenium node 4.17.0 (revision e52b1be057*): http://192.168.1.144:5557 12:58:59.995 WARN [RelaySessionFactory.isServiceUp] - Error checking service status http://192.168.1.144:4723/status. java.io.IOException: HTTP/1.1 header parser received no bytes 12:58:59.996 ERROR [NodeServer$1.lambda$start$1] - Node is not alive: http://192.168.1.144:5557 is DOWN

VitaliiPivtorak avatar Jan 23 '24 11:01 VitaliiPivtorak

OK, might be related to the JDK 11 HTTP client.

diemol avatar Jan 23 '24 16:01 diemol

@VitaliiPivtorak im getting same issue by using 4.13 version also.

ShivasinyV avatar Jan 25 '24 04:01 ShivasinyV

@VitaliiPivtorak im getting same issue by using 4.13 version also.

Same toml file only change grid version (for hub and node run) is working: @_ Grid % java -jar selenium-server-4.13.0.jar node --config node4.toml 10:41:19.765 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding 10:41:19.768 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing 10:41:19.823 INFO [UnboundZmqEventBus.] - Connecting to tcp://0.0.0.0:4442 and tcp://0.0.0.0:4443 10:41:19.845 INFO [UnboundZmqEventBus.] - Sockets created 10:41:20.847 INFO [UnboundZmqEventBus.] - Event bus ready 10:41:20.939 INFO [NodeServer.createHandlers] - Reporting self as: http://192.168.1.144:5557 10:41:20.949 INFO [NodeOptions.getSessionFactories] - Detected 10 available processors 10:41:20.958 INFO [RelayOptions.getSessionFactories] - Adding relay configs for http://localhost:4723 10:41:20.963 INFO [RelayOptions.lambda$getSessionFactories$1] - Mapping Capabilities {appium:automationName: UiAutomator2, appium:deviceName: Pixar 5а, appium:platformVersion: 13, platformName: ANDROID}, 1 times 10:41:20.963 INFO [RelayOptions.lambda$getSessionFactories$1] - Mapping Capabilities {appium:automationName: UiAutomator2, appium:deviceName: Pixar 4, appium:platformVersion: 13, platformName: ANDROID}, 1 times 10:41:20.987 INFO [Node.] - Binding additional locator mechanisms: relative 10:41:21.064 INFO [NodeServer$1.start] - Starting registration process for Node http://192.168.1.144:5557 10:41:21.065 INFO [NodeServer.execute] - Started Selenium node 4.13.0 (revision ba948ece5b*): http://192.168.1.144:5557 10:41:21.233 INFO [NodeServer$1.lambda$start$1] - Sending registration event... 10:41:21.259 INFO [NodeServer.lambda$createHandlers$2] - Node has been added

VitaliiPivtorak avatar Jan 25 '24 08:01 VitaliiPivtorak

I think I have seen a similar issue with a relay node in between Appium and a Grid Hub, the /status check fails despite all hosted endpoints being reachable with other HTTP tools. I asked the User Group about this, that thread has a few common details to the above reports: https://groups.google.com/g/selenium-users/c/WZB5G6hbug0/m/33OP2JTIAAAJ

adam-chaters avatar Jan 25 '24 20:01 adam-chaters

I'm having the exact issue using the latest hub & node version 4.17 in docker Appium /status returns the correct result when I ping it with curl from within node container

andrii-rymar avatar Jan 26 '24 13:01 andrii-rymar

No luck with SE_JAVA_OPTS="-Djdk.httpclient.keepalive.timeout=10" recommended here

andrii-rymar avatar Jan 26 '24 16:01 andrii-rymar

Also running into this issue. Running selenium 4.16.1, openjdk 21.0.1. Also tried running the relay server on a different machine same error as OP.

18:00:50.851 WARN [RelaySessionFactory.isServiceUp] - Error checking service status http://(host_name):11000/status. java.io.IOException: HTTP/1.1 header parser received no bytes 18:00:51.824 WARN [RelaySessionFactory.isServiceUp] - Error checking service status http://(host_name):11000/status. java.io.IOException: HTTP/1.1 header parser received no bytes

EDIT: Downgrading to selenium 4.13.0 fixed the problem like OP suggested (Only downgraded the relay server, the hub still running 4.16.1).

Jiurong-Yang avatar Jan 30 '24 02:01 Jiurong-Yang

Still getting this error even tho i tried to downgrade to selenium 4.13.0 07:18:13.244 WARN [RelaySessionFactory.isServiceUp] - Error checking service status http://(host_name)4723/status. java.io.IOException: HTTP/1.1 header parser received no bytes

ddionysopoulos avatar Feb 13 '24 07:02 ddionysopoulos

Hello guys, I have the same issue. Downgrading Appium also resolves the problem.

hornyja4 avatar Feb 25 '24 21:02 hornyja4

I also faced the same issue using selenium-server (grid) version 4.16.1 and 4.18.1. but after downgrading the seleium-server(grid) to 4.13.0 working fine without any issue

in my case I'm using appium version 2.5.1, windows as an OS, and openjdk 11.0.2 working properly by using http://localhost:4723 or http://{localIpAddress}:4723 at config.toml

AryawanWijaya avatar Mar 03 '24 09:03 AryawanWijaya

When is this getting fixed?

tking16 avatar Mar 19 '24 09:03 tking16

We have no timeline for this, as this issue currently stands in a low-priority area. If you wish to help, please feel free to comment on your approach, and we will help you when you send a PR. Thanks!

diemol avatar Mar 19 '24 12:03 diemol

Please fix it.

zcindori avatar Mar 22 '24 13:03 zcindori

Same issue for me. its only working for the appium version 2.3.0 or below. Anything above 2.3.0 appium version it is not working. If we downgrade the appium to 2.3.0 or less it is working for any of the selenium grid 4 version. seems fix is required from appium versioning side not from selenium grid 4 side. This is getting issue for us, we cannot use the latest appium version. We stuck with appium 2.3.0 or below . Please fix it.

vinodverma9171 avatar Apr 10 '24 12:04 vinodverma9171

@mykola-mokhnach do you know what you folks changed in the Appium server to cause this?

diemol avatar Apr 10 '24 14:04 diemol

@mykola-mokhnach do you know what you folks changed in the Appium server to cause this?

We did not so any changes. However, I've seen a similar exception (java.io.IOException: HTTP/1.1 header parser received no bytes) before when the standard java HTTP client tries to connect to a running Express server. The solution was to enforce HTTP1_1 on the client.

mykola-mokhnach avatar Apr 11 '24 20:04 mykola-mokhnach

@mykola-mokhnach @diemol Issue still exist, Let me re-phrase the exact issue again.

Problem statement: Not able to connect to selenium grid.Error checking service status http://XXXXXXX. java.io.IOException: HTTP/1.1 header parser received no byte

When it is occurring: Only with appium version higher than 2.3.0, There is no issue with connecting with selenium grid if the appium version is 2.3.0 or lower, I tried connecting with appium 2.3.0/lower appium version with selenium grid latest 4.19.1 there is no issue.

Somebody needs to dig out the issue from appium server side not from the selenium grid side.

vinodverma9171 avatar Apr 12 '24 11:04 vinodverma9171

@mykola-mokhnach @diemol Please let us know the steps or commands to enforce HTTP1_1 on the client, Will it solve this issue ?

vinodverma9171 avatar Apr 19 '24 14:04 vinodverma9171

Hi @mykola-mokhnach , i too am getting this issue, even when following the basic appium grid example https://appium.io/docs/en/2.0/guides/grid/ .

I have the following installed:

  • OS: OSX Sonoma 14.4.1
  • Appium version: 2.5.3
  • Selenium grid version: selenium-server-4.19.1.jar

Below is the appium config i'm using:

server:
  port: 4723
  use-drivers:
    - xcuitest
  default-capabilities:
    wdaLocalPort: 8100
    mjpegServerPort: 9100
    mjpegScreenshotUrl: "http://localhost:9100"`

Below is the node config i'm using:

[server]
port = 5555

[node]
detect-drivers = false

[relay]
url = "http://localhost:4723"
status-endpoint = "/status"
configs = [
    "1", "{\"platformName\": \"android\", \"appium:platformVersion\": \"10\", \"appium:deviceName\": \"Samsung SM-G988\", \"appium:automationName\": \"uiautomator2\"}"
]

When firing up Appium it seems ok: appium

The hub also seems ok: hub

When firing up the node I get this: node

As @vinodverma9171 mentioned, if you can provide instructions on how to enforce HTTP1_1 on the client that would be appreciated.

bassani2014 avatar Apr 19 '24 21:04 bassani2014

@bassani2014 Yes that is ongoing issue , we wanted to know how we can enforce the http1_1 ? Just a work around if you downgrade your appium to 2.3.0 or less you won’t see this issue. But we will not be able to use latest appium at all. @mykola-mokhnach Please advise . In this scenario nobody will be able to use the latest appium at all. It’s blocker for everybody to use latests appium version.

vinodverma9171 avatar Apr 19 '24 22:04 vinodverma9171

Via PR #13849, I have tried to add a config to enforce the protocol version in HttpClient config used in relay. TOML config looks like

[server]
port = 5555

[node]
detect-drivers = false

[relay]
url = "http://localhost:4723"
status-endpoint = "/status"
protocol-version = "HTTP/1.1"
configs = [
    "1", "{\"platformName\": \"android\", \"appium:platformVersion\": \"10\", \"appium:deviceName\": \"Samsung SM-G988\", \"appium:automationName\": \"uiautomator2\"}"
]

A quick test looks like

image

VietND96 avatar Apr 21 '24 08:04 VietND96

@VietND96 Above suggested solution did not work for me , it is the same issue. image

vinodverma9171 avatar Apr 21 '24 13:04 vinodverma9171

@vinodverma9171, that is a new implementation, and wait for merging in the PR. My above demo with a dev package was built locally. You can try a preview by downloading this server jar (since GH limit attachment 33MB)

VietND96 avatar Apr 21 '24 14:04 VietND96

As a possible workaround from the server side that might improve the HTTP/2 interoperability I could only see the enablement of https. See https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/tls.md for more details.

mykola-mokhnach avatar Apr 22 '24 06:04 mykola-mokhnach

Sorry for bringing this up again. But has anyone tried to actually run a test against this? Adding "protocol-version" worked for adding a relay node, but the same error happened again when running a test against it. I tried this out in v4.20.0, btw.

Looks like the same code that create client in isServiceUp() is needed in the apply() function above too. I can try to take care of this and make a pr.

chanatan avatar Apr 25 '24 15:04 chanatan