Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-58933

At BaseDeployer.postDeployWebSphere we are executing wsadmin.sh and getting its exitValue without checking if process has existed

    Details

      Description

      At BaseDeployer.postDeployWebSphere we are executing wsadmin.sh script and getting its exitValue without checking if process has existed:

      ProcessBuilder processBuilder = new ProcessBuilder(commands);
      processBuilder.redirectErrorStream(true);
      Process process = processBuilder.start();
      int exitValue = process.exitValue();
      

      So in case we call process.exitValue() before script ends and after its output stream is closed, following exception is thrown:

      11:08:13,687 ERROR [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:220] com.liferay.portal.kernel.deploy.auto.AutoDeployException: java.lang.IllegalThreadStateException: process hasn't exited
      com.liferay.portal.kernel.deploy.auto.AutoDeployException: java.lang.IllegalThreadStateException: process hasn't exited
      	at com.liferay.portal.tools.deploy.BaseDeployer.autoDeploy(BaseDeployer.java:216)
      	at com.liferay.portal.deploy.auto.ThreadSafeAutoDeployer.autoDeploy(ThreadSafeAutoDeployer.java:36)
      	at com.liferay.portal.deploy.auto.PortletAutoDeployListener.deploy(PortletAutoDeployListener.java:88)
      	at com.liferay.portal.kernel.deploy.auto.AutoDeployDir.deploy(AutoDeployDir.java:50)
      	at com.liferay.portal.kernel.deploy.auto.AutoDeployDir.processFile(AutoDeployDir.java:211)
      	at com.liferay.portal.kernel.deploy.auto.AutoDeployDir.scanDirectory(AutoDeployDir.java:275)
      	at com.liferay.portal.kernel.deploy.auto.AutoDeployScanner.run(AutoDeployScanner.java:58)
      Caused by: java.lang.IllegalThreadStateException: process hasn't exited
      	at java.lang.UNIXProcess.exitValue(UNIXProcess.java:271)
      	at com.liferay.portal.tools.deploy.BaseDeployer.postDeployWebSphere(BaseDeployer.java:1782)
      	at com.liferay.portal.tools.deploy.BaseDeployer.postDeploy(BaseDeployer.java:1638)
      	at com.liferay.portal.tools.deploy.BaseDeployer.deployFile(BaseDeployer.java:1010)
      	at com.liferay.portal.tools.deploy.BaseDeployer.autoDeploy(BaseDeployer.java:213)
      	... 6 more
      11:08:14,012 ERROR [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:224] Add marketplace-portlet-6.2.0.1.war to the blacklist
      

      It seems problem is produced when wsadmin.sh script closes output stream, so we stop reading its output and we call to process.exitValue() without checking if process has finished.

      If wsadmin.sh does not close the output stream, our deploy code works fine, as String output = StringUtil.read(inputStream); is blocked until output ends, even script stops for some minutes.

      The main issue is that plugin is added to blacklist but perhaps script finished ok (we don't know as process didn't already exited)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              beck.liu Beck Liu
              Reporter:
              jorge.diaz Jorge Diaz
              Participants of an Issue:
              Recent user:
              Esther Sanz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 10 weeks, 1 day ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 Alpha 3