seleniumhq-community / docker-seleniarm

Multi-Arch (arm64/armhf/amd64) Docker images for the Selenium Grid Server
https://hub.docker.com/u/seleniarm
Other
249 stars 26 forks source link

[πŸ› Bug]: IllegalArgumentException thrown with standalone-chromium container #33

Closed bkline closed 9 months ago

bkline commented 1 year ago

What happened?

Running a phpunit FunctionalJavascript test against a Drupal 9 site fails on an M1 Mac with a cascade of the same IllegalArgumentException ("non-positive contentLength") thrown over and over. The same test passes on an amd64 Mac using a drupalci/webdriver-chromedriver container.

Complete logs from the seleniarm/standalone-chromium container are attached. A representative segment is shown in the Relevant log output field.

Command used to start Selenium Grid with Docker

docker run --rm -it -p 4444:4444 -p 5900:5900 -p 7900:7900 --shm-size 2g --network ebms_net --name chrome seleniarm/standalone-chromium:latest

Relevant log output

16:33:11.542 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:129)
    at org.openqa.selenium.remote.http.jdk.JdkHttpMessages.createRequest(JdkHttpMessages.java:76)
    at org.openqa.selenium.remote.http.jdk.JdkHttpClient.execute(JdkHttpClient.java:292)
    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:472)
    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:248)
    at org.openqa.selenium.grid.web.CombinedHandler.execute(CombinedHandler.java:59)
    at org.openqa.selenium.grid.web.RoutableHttpClientFactory$1.execute(RoutableHttpClientFactory.java:72)
    at org.openqa.selenium.grid.web.ReverseProxyHandler.execute(ReverseProxyHandler.java:92)
    at org.openqa.selenium.grid.router.HandleSession.execute(HandleSession.java:122)
    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.http.Route$CombinedRoute.handle(Route.java:336)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
    at org.openqa.selenium.grid.router.Router.execute(Router.java:91)
    at org.openqa.selenium.grid.web.EnsureSpecCompliantResponseHeaders.lambda$apply$0(EnsureSpecCompliantResponseHeaders.java:34)
    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.remote.http.Route$CombinedRoute.handle(Route.java:336)
    at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
    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.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)
[repeated many times]

Operating System

Mac M1 Pro Ventura 13.2.1

Docker Selenium version (tag)

sha256:1395df7b760be44bfa6f09702b768f6bad81dc9686672db434f426ab13c3ae7c created 2023-03-10T05:13:37.445513745Z (followed the instructions in the README, which use "latest")

bkline commented 1 year ago

It turned out that following the instructions on the README page to use "latest" for the standalone images wasn't such a good idea after all. When I replaced that with the version from a year ago (4.1.4-20220429) the tests passed.

jamesmortensen commented 1 year ago

Hi @bkline sorry for the delayed response. It seems like we might have a regression on our hands as the latest version is 4.8.3.

Would you be able to supply a simplified phpunit example that demonstrates the error. It would help us troubleshoot further. Thank you!

bkline commented 1 year ago

Sorry, there are so many layers underneath the level at which my code is working that I wouldn't know where to begin.

bkline commented 1 year ago

I can, however, show you how to reproduce the failures. I recognize that it will not be what you were hoping for (a stripped-down repro case as close to plain PHP as possible), but the steps are pretty straightforward. Assumes git, docker, and sed are installed.

  1. cd /tmp
  2. git clone https://github.com/NCIOCPL/ebms.git
  3. cd ebms
  4. git checkout fiordland
  5. sed -i '' 's/4.1.4-20220429/latest/g' docker-compose.yml
  6. docker compose up -d
  7. docker exec -it ebms-web-1 bash # now you're in the container
  8. composer install
  9. vendor/bin/phpunit web/modules/custom/ebms_travel # will fail
  10. exit # now we're back on the host machine
  11. docker logs ebms-chrome-1 # piped to less if available

Those logs are pretty much what I posted to this issue (though version numbers will change as latest moves on). I did notice that the versions appearing in the logs for ChromiumDriver are a little behind what's listed on the releases page for latest, so presumably latest has different meanings depending on the context.

If you skip step #5 (leaving the version of the standalone-chromium image pinned at the version I determined was still working) then the tests will pass and those exceptions won't appear in the logs.

I totally understand if you prefer not to bother with such a bulky repro case, but as noted in my previous comment, I'm afraid it's the best I can do in this case. And I do have the fallback of the working earlier version. πŸ˜…

jamesmortensen commented 1 year ago

Hi Bob,

Thanks for the details. I'll see what I can do to replicate the problem when I get time to dig into it.

Have a great week! James

On Sun 16 Apr, 2023, 21:09 Bob Kline, @.***> wrote:

I can, however, show you how to reproduce the problem. I recognize that it will not be what you were hoping for (a stripped-down repro case as close to plain PHP as possible), but the steps are pretty straightforward. Assumes git, docker, and sed are installed.

  1. cd /tmp
  2. git https://github.com/NCIOCPL/ebms.git
  3. cd ebms
  4. git co fiordland
  5. sed -i '' 's/4.1.4-20220429/latest/g' docker-compose.yml
  6. docker compose up -d
  7. docker exec -it ebms-web-1 bash # now you're in the container
  8. composer install
  9. vendor/bin/phpunit web/modules/custom/ebms_travel # will fail
  10. exit # now we're back on the host machine
  11. docker logs ebms-chrome-1 # piped to less if available

Those logs are pretty much what I posted to this issue (though version numbers will change as latest moves on). I did notice that the versions appearing in the logs for ChromiumDriver are a little behind what's listed on the releases https://github.com/seleniumhq-community/docker-seleniarm/releases page for latest so presumably latest has different meanings depending on the context.

If you skip step #5 https://github.com/seleniumhq-community/docker-seleniarm/issues/5 (leaving the version of the standalone-chromium image pinned at the version I determined was still working then the tests will pass and those exceptions won't appear in the logs.

I totally understand if you prefer not to bother with such a bulky repro case, but as noted in my previous comment, I'm afraid it's the best I can do in this case. And I do have the fallback of the working earlier version. πŸ˜…

β€” Reply to this email directly, view it on GitHub https://github.com/seleniumhq-community/docker-seleniarm/issues/33#issuecomment-1510415906, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKBH2H6MCSQOCJBHSXD7SDXBQHDFANCNFSM6AAAAAAWPYOHQM . You are receiving this because you commented.Message ID: @.***>

jamesmortensen commented 1 year ago

Hi @bkline

I did run into a few setup problems that I believe I addressed. I added your steps, plus the extra ones I figured out I needed, in a script called bootstrap.sh, which I added to a fork of edbs: https://github.com/jamesmortensen/ebms/tree/fiordland

When I try to execute the tests, it seems nothing at all happens. Everything appears to hang:

$ root@5d027b693681:/var/www# vendor/bin/phpunit -v --debug web/modules/custom/ebms_travel/tests/src/FunctionalJavascript/TravelTest.php 
PHPUnit 9.5.16 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.1.2-1ubuntu2.11
Configuration: /var/www/phpunit.xml

Test 'Drupal\Tests\ebms_travel\FunctionalJavascript\TravelTest::testTravel' started

I did add a small php-webdriver demo.sh script which basically opens google.com in the container and closes it. I can see it's working. When I see the chrome logs, it does seem like things are just hanging with the vendor/bin/phpunit command. There's no log activity at all, no exceptions, nothing. Do you know what might be wrong with my setup? I followed your steps but also had to configure git to not complain about cloning in the /var/www folder in the container.

Is it possible to work with the demo.sh script and add in more dependencies you're using to try to replicate the issue? Hope this helps.

bkline commented 1 year ago

Let me investigate and see if I can figure out why the repro works differently for each of us.

diemol commented 9 months ago

I will close this but if more information is available, we can reopen it and continue.

github-actions[bot] commented 7 months ago

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.