wso2 / product-micro-integrator

The cloud-native configuration driven runtime that helps developers implement composite microservices.
https://wso2.com/integration/
Apache License 2.0
204 stars 221 forks source link

[Bug]: MI need to restart when a CApp deployment failed #3643

Open Bhashinee opened 1 month ago

Bhashinee commented 1 month ago

Description

Environment: Windows

Noticed that MI failed to recover from certain faulty Capps. For an example, CApp deployment failure like below has happened.

2024-03-21 23:42:32,985] [] : mi : ERROR {org.apache.synapse.config.SynapseConfiguration} - Duplicate swagger definition by the name: pnc-paperlessjwt-api  
[2024-03-21 23:42:32,985] [] : mi : ERROR {org.wso2.micro.integrator.initializer.deployment.application.deployer.CappDeployer} - Error while deploying carbon application /home/wso2carbon/wso2mi-4.2.0/repository/deployment/server/carbonapps/pnc-paperlessjwt-papiCompositeExporter_1.0.0.car org.apache.synapse.SynapseException: Duplicate swagger definition by the name: pnc-paperlessjwt-api|     at org.apache.synapse.config.SynapseConfiguration.handleException(SynapseConfiguration.java:1800)|        at org.apache.synapse.config.SynapseConfiguration.addSwaggerDefinition(SynapseConfiguration.java:484)|  at org.wso2.micro.integrator.initializer.deployment.application.deployer.CappDeployer.searchArtifacts(CappDeployer.java:482)|     at org.wso2.micro.integrator.initializer.deployment.application.deployer.CappDeployer.deployCarbonApps(CappDeployer.java:182)|    at org.wso2.micro.integrator.initializer.deployment.application.deployer.CappDeployer.deploy(CappDeployer.java:145)|    at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)|    at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)|    at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:153)|    at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)|  at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)|   at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)|     at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)|  at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)|        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)|   at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)|    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)|    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)|     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)|   at java.base/java.lang.Thread.run(Thread.java:833)

Then we fixed the issue and redeployed. Still the same CApp (that was failing before) was deploying and failing. We were getting the same error. MI did not cover with the modified until a restart is done. It kept giving above error. Does MI keep failed CApps in a cache and try to do deployments? Why MI did not pick up the CApp that was updated?

Steps to Reproduce

No response

Affected Version(s)

MI 4.2.0

Related issue(s) (optional)

Transferred from https://github.com/wso2-enterprise/wso2-mi-internal/issues/658

jairo-fernandezr commented 3 days ago

Hi folks, I experience a very similar behavior, in my case I cannot assure that changes are not taken from the deployment, but after a JBDC connection problem with a database during deployment, I removed the faulty application, fixed the db connection problem, and then try to redeploy the CAPP.

The CAPP does not deploy with the following errors in log file:

[2024-11-19 17:43:46,084]  INFO {CappDeployer} - Undeploying Faulty Carbon Application On : /home/wso2carbon/wso2mi-4.2.0/repository/deployment/server/carbonapps/test-CompositeExporter_1.0.0-SNAPSHOT.car
[2024-11-19 17:43:46,201] ERROR {SynapseConfiguration} - Duplicate swagger definition by the name: api_test
[2024-11-19 17:43:46,201] ERROR {CappDeployer} - Error while deploying carbon application /home/wso2carbon/wso2mi-4.2.0/repository/deployment/server/carbonapps/test-CompositeExporter_1.0.0-SNAPSHOT.car org.apache.synapse.SynapseException: Duplicate swagger definition by the name: api_test

The only way we've found so far to get rid of the error once it is present is to restart the server, which is very annoying when we encounter the problem in a production environment.

I'm using MI 4.2.0-99 I would greatly appreciate any help.

Regards