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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: Now legacy-protocol client is unable to run tests on docker chrome 107 regardless docker selenium's version #1723

Closed
shihchenman opened this issue Nov 11, 2022 · 5 comments

Comments

@shihchenman
Copy link

shihchenman commented Nov 11, 2022

What happened?

php-webdriver 1.11.1 and 1.13.0 with json wire protocol (w3c=false)
Standalone or grid, docker chrome 107.0 with docker selenium 4.5.3 or 4.6.0 caused tests all fail with error "non-positive contentLength: 0".
Which means our tests currently have to stay with docker chrome 106.0 and unable to move on to docker chrome 107.0.
I am aware the legacy protocl support will be dropped soon, just wondering if it can be postponed a bit more.

phpExample.zip

Command used to start Selenium Grid with Docker

# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: '3'
services:
  chrome0:
    image: selenium/node-chrome:4.6.0-20221104
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_NODE_MAX_SESSIONS=10
      - TZ=America/Edmonton
    volumes:
      - "${WORKSPACE}/log:/home/seluser/Downloads"
    ports:
      - "6900:7900"

  chrome1:
    image: selenium/node-chrome:4.6.0-20221104
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_NODE_MAX_SESSIONS=10
      - TZ=America/Edmonton
    volumes:
      - "${WORKSPACE}/log:/home/seluser/Downloads"
    user: 
      "${UID}:${GID}"
    ports:
      - "6901:7900"

  selenium-hub:
    #https://hub.docker.com/r/selenium/hub/tags
    image: selenium/hub:4.6.0-20221104
    environment:
      - TZ=America/Edmonton
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"

Relevant log output

21:25:28.064 DEBUG [SeleniumSpanExporter$1.lambda$export$4] - SpanData{spanContext=ImmutableSpanContext{traceId=9cf60f244d513d148076a2d3875945a3, spanId=908dc72fc6b939c0, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=true}, parentSpanContext=ImmutableSpanContext{traceId=9cf60f244d513d148076a2d3875945a3, spanId=4202e2387c103b68, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=true, valid=true}, resource=Resource{schemaUrl=https://opentelemetry.io/schemas/1.13.0, attributes={service.name="unknown_service:java", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.19.0"}}, instrumentationScopeInfo=InstrumentationScopeInfo{name=default, version=null, schemaUrl=null, attributes={}}, name=httpclient.execute, kind=INTERNAL, startEpochNanos=1668140728062000000, endEpochNanos=1668140728063539299, attributes=AttributesMap{data={http.method=POST, span.kind=client, http.target=/session/e404bcc5ea25f587e77dceaff910adf2/element/0.11162527343860607-1/submit}, capacity=128, totalAddedValues=3}, totalAttributeCount=3, events=[], totalRecordedEvents=0, links=[], totalRecordedLinks=0, status=ImmutableStatusData{statusCode=UNSET, description=}, hasEnded=true}
21:25:28.064 DEBUG [SeleniumSpanExporter$1.lambda$export$4] - SpanData{spanContext=ImmutableSpanContext{traceId=9cf60f244d513d148076a2d3875945a3, spanId=9626ee2828cbf58f, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=true}, parentSpanContext=ImmutableSpanContext{traceId=9cf60f244d513d148076a2d3875945a3, spanId=4202e2387c103b68, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=true, valid=true}, resource=Resource{schemaUrl=https://opentelemetry.io/schemas/1.13.0, attributes={service.name="unknown_service:java", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.19.0"}}, instrumentationScopeInfo=InstrumentationScopeInfo{name=default, version=null, schemaUrl=null, attributes={}}, name=reverse_proxy, kind=INTERNAL, startEpochNanos=1668140728061000000, endEpochNanos=1668140728063613209, attributes=AttributesMap{data={http.method=POST, http.target=/session/e404bcc5ea25f587e77dceaff910adf2/element/0.11162527343860607-1/submit}, capacity=128, totalAddedValues=2}, totalAttributeCount=2, events=[], totalRecordedEvents=0, links=[], totalRecordedLinks=0, status=ImmutableStatusData{statusCode=UNSET, description=}, hasEnded=true}
21:25:28.065 WARN [SpanWrappedHttpHandler.execute] - Unable to execute request: non-positive contentLength: 0
java.lang.IllegalArgumentException: non-positive contentLength: 0
	at java.net.http/java.net.http.HttpRequest$BodyPublishers.fromPublisher(HttpRequest.java:539)
	at org.openqa.selenium.remote.http.jdk.JdkHttpMessages.notChunkingBodyPublisher(JdkHttpMessages.java:124)
	at org.openqa.selenium.remote.http.jdk.JdkHttpMessages.createRequest(JdkHttpMessages.java:76)
	at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:280)
	at org.openqa.selenium.remote.tracing.TracedHttpClient.execute(TracedHttpClient.java:55)
	at org.openqa.selenium.grid.web.ReverseProxyHandler.execute(ReverseProxyHandler.java:92)
	at org.openqa.selenium.grid.node.ProtocolConvertingSession.execute(ProtocolConvertingSession.java:75)
	at org.openqa.selenium.grid.node.local.SessionSlot.execute(SessionSlot.java:127)
	at org.openqa.selenium.grid.node.local.LocalNode.executeWebDriverCommand(LocalNode.java:460)
	at org.openqa.selenium.grid.node.ForwardWebDriverCommand.execute(ForwardWebDriverCommand.java:35)
	at org.openqa.selenium.remote.http.Route$PredicatedRoute.handle(Route.java:373)
	at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
	at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:86)
	at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
	at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
	at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
	at org.openqa.selenium.grid.node.Node.execute(Node.java:240)
	at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
	at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
	at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
	at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
	at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
	at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
	at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
	at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
21:25:28.066 DEBUG [SeleniumSpanExporter$1.lambda$export$4] - SpanData{spanContext=ImmutableSpanContext{traceId=9cf60f244d513d148076a2d3875945a3, spanId=4202e2387c103b68, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=true}, parentSpanContext=ImmutableSpanContext{traceId=9cf60f244d513d148076a2d3875945a3, spanId=4135d690ac70b55b, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=true, valid=true}, resource=Resource{schemaUrl=https://opentelemetry.io/schemas/1.13.0, attributes={service.name="unknown_service:java", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.19.0"}}, instrumentationScopeInfo=InstrumentationScopeInfo{name=default, version=null, schemaUrl=null, attributes={}}, name=node.forward_command, kind=INTERNAL, startEpochNanos=1668140728058000000, endEpochNanos=1668140728065452440, attributes=AttributesMap{data={http.method=POST, random.key=d84fe1d6-0580-41c1-a656-569fb63b55d4, error=true, span.kind=server, http.target=/session/e404bcc5ea25f587e77dceaff910adf2/element/0.11162527343860607-1/submit}, capacity=128, totalAddedValues=5}, totalAttributeCount=5, events=[ImmutableEventData{name=exception, attributes={exception.message="Unable to execute request: non-positive contentLength: 0", exception.stacktrace="java.lang.IllegalArgumentException: non-positive contentLength: 0

Operating System

Ubuntu 20.04

Docker Selenium version (tag)

4.6.0-20221104

@shihchenman shihchenman changed the title [馃悰 Bug]: [馃悰 Bug]: Now legacy-protocol client is unable to run tests on docker chrome 107 regardless docker selenium's version Nov 11, 2022
@diemol
Copy link
Member

diemol commented Nov 11, 2022

Not related to the error, which we still need to investigate, but please be aware that support for JWP ( json wire protocol (w3c=false)) in Grid is going away soon.

@weitzman
Copy link

This is affecting our open source project as well https://gitlab.com/weitzman/drupal-test-traits/-/jobs/3311080540

@shihchenman
Copy link
Author

shihchenman commented Nov 12, 2022

I found using chromedriver directly works.
java -jar -Dwebdriver.chrome.driver=/selenium/chromedriver-107.0.5304.62 /selenium/selenium-server-4.6.0.jar standalone

But using the jdk-http-client.jar would produce the error mentioned above, and this jar is used in the grid as well
java -jar -Dwebdriver.http.factory=jdk-http-client /selenium/selenium-server-4.6.0.jar --ext /selenium/selenium-http-jdk-client.jar standalone

What's the difference between using chrome driver directly and using the selenium-http-jdk-client.jar?

As a quick test, I created a test image with the following dockerfile that seems to work with grid test for chrome107. But I am still hoping our current tests can work with official/standard selenium image to buy time to move to w3c compliant test code.
FROM selenium/node-chrome

RUN sudo sed -i 's#Dwebdriver.http.factory=jdk-http-client#Dwebdriver.chrome.driver=/usr/bin/chromedriver#' /opt/bin/start-selenium-node.sh

RUN sudo sed -i 's#--ext ${EXTRA_LIBS}##' /opt/bin/start-selenium-node.sh

@diemol
Copy link
Member

diemol commented Aug 1, 2023

I will close this because the supported version (4.11.0 at the moment) does not support JWP anymore.
https://www.selenium.dev/blog/2022/legacy-protocol-support/

@diemol diemol closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2023
Copy link

github-actions bot commented Dec 9, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants