Konrad Windszus created SLING-11937:
---------------------------------------

             Summary: sling-maven-plugin: Unstable ITs: Uninstall bundle 
returns a 404
                 Key: SLING-11937
                 URL: https://issues.apache.org/jira/browse/SLING-11937
             Project: Sling
          Issue Type: Improvement
          Components: Maven Plugins and Archetypes
    Affects Versions: Sling Maven Plugin 3.0.2
            Reporter: Konrad Windszus
            Assignee: Konrad Windszus


The ITs for the sling-maven-plugin are unstable (particularly on Windows). 
They fail with

{code}
[INFO] --- sling:3.0.3-SNAPSHOT:install-file (bundle-install) @ example-pom ---
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/sling/org.apache.sling.commons.messaging/1.0.2/org.apache.sling.commons.messaging-1.0.2.jar
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/sling/org.apache.sling.commons.messaging/1.0.2/org.apache.sling.commons.messaging-1.0.2.jar
 (9.1 kB at 27 kB/s)
[INFO] Resolved artifact to 
F:\jenkins\jenkins-home\712657a4\workspace\odules_sling-maven-plugin_master\jdk_1.8_latest\.repository\org\apache\sling\org.apache.sling.commons.messaging\1.0.2\org.apache.sling.commons.messaging-1.0.2.jar
[INFO] Installing Bundle 
org.apache.sling.commons.messaging(F:\jenkins\jenkins-home\712657a4\workspace\odules_sling-maven-plugin_master\jdk_1.8_latest\.repository\org\apache\sling\org.apache.sling.commons.messaging\1.0.2\org.apache.sling.commons.messaging-1.0.2.jar)
 to http://localhost:50972/system/console/ via WebConsole...
[INFO] Bundle installed successfully
[INFO] 
[INFO] --- sling:3.0.3-SNAPSHOT:uninstall (bundle-uninstall) @ example-pom ---
[INFO] Uninstalling Bundle org.apache.sling.commons.messaging from 
http://localhost:50972/system/console/ via WebConsole...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.721 s
[INFO] Finished at: 2023-07-02T02:08:33Z
[INFO] ------------------------------------------------------------------------
[INFO] [jenkins-event-spy] Generated 
F:\jenkins\jenkins-home\712657a4\workspace\odules_sling-maven-plugin_master\jdk_1.8_latest@tmp\withMaven4b5a6f97\maven-spy-20230702-020831-4455121863055328026922.log
[ERROR] Failed to execute goal 
org.apache.sling:sling-maven-plugin:3.0.3-SNAPSHOT:uninstall (bundle-uninstall) 
on project example-pom: Uninstall from http://localhost:50972/system/console/ 
failed, cause: status code: 404, reason phrase: Not Found -> [Help 1]
{code}

The reason is that the installation happens asynchronously in a background 
thread in 
https://github.com/apache/felix-dev/blob/8e35c940a95c91f3fee09c537dbaf9665e5d027e/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java#L1726,
 so there is a race condition if the uninstall is triggered before the 
installation in the background thread is finished.

Also the documentation in currently incorrectly states:

{quote}
Felix Web Console
The plugin by default places an HTTP POST request to the Felix Web Console. 
This will achieve both upload and installation of the bundle in one request 
synchronously.
{quote}

In fact this is an asynchronous operation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to