Details
-
Bug
-
Resolution: Fixed
-
Minor
-
14.4.2
-
None
-
Unit
-
Unknown
-
N/A
-
N/A
-
Description
Steps to reproduce
- Use the PDF export with the headless Chrome running in a Docker container created by XWiki (the default)
- Change the configuration of the Chrome Docker container in the PDF export administration (e.g. the container name or the remote debugging port), which stops the current container
Result
Sometimes the following error is logged:
ERROR g.d.a.a.ResultCallbackTemplate - Error during callback
com.github.dockerjava.api.exception.NotFoundException: Status 404: {"message":"No such container: 503a136f7d164b930e7a800ecc1e0990..."}
at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:241)
at com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
at java.base/java.lang.Thread.run(Thread.java:1474)
Expected
Nothing is logged: the container was stopped as asked.
Analysis
The Chrome container is created with automatic removal (ContainerManager#getHostConfig()). ContainerManager#stopContainer() stops it, then waits for it to be stopped with an asynchronous waitContainerCmd. When Docker has already removed the stopped container, the wait request fails with a 404, and docker-java's ResultCallbackTemplate#onError() logs it at error level before passing it to awaitCompletion(), which rethrows it. stopContainer() then ignores the NotFoundException, so the container is stopped as expected and only the error log remains. docker-java reported issue: https://github.com/docker-java/docker-java/issues/1689 (closed without change), the callback being meant to be extended.
Seen in PDFExportIT#updatePDFExportConfigurationWithValidation in the XWiki Environment Tests job (MySQL in build 1409, Oracle in build 1411). Found while assessing the impact of failing functional tests on ERROR logs again.
Proposed fix
Wait for the container to stop with a callback which completes, instead of failing, when the container doesn't exist anymore.
Attachments
Issue Links
- is caused by
-
XWIKI-19270 Add support for performing the PDF export using a browser running in a Docker container
-
- Closed
-