<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Zombie task is created after finishing callable subprocess. How to avoid it?</title><link>https://answers.axonivy.com/questions/2932/zombie-task-is-created-after-finishing-callable-subprocess-how-to-avoid-it</link><description>&lt;p&gt;Hi all&lt;/p&gt;
&lt;p&gt;We're using ivy 6.3, and have face the problem that we implement a restfulAPI by java code,  when we trigger the callable subprocess from it. After callablesub is finished, it will remain a zombie task.
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/Untitled_OKBhfzB.png"&gt;
Why i need to call ivy subprocess from api?
Answer: i need to call ivy.repo() to persist my data then response the id. This api can't be called in restful.&lt;/p&gt;
&lt;p&gt;Here is my callable subprocess:&lt;/p&gt;
&lt;p&gt;&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/Untitled_xUuYAvG.png"&gt;&lt;/p&gt;
&lt;p&gt;and it's the code of api:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;@Path("{applicationName}/individualch")
@Produces(MediaType.APPLICATION_JSON)
public class IndividualchApi  {

    /**
     * This API is used by third party application when it want to call
     * to create dossier Response message is cobId
     * @param provider
     * @param externalId
     * @param sobDossier
     * @return
     */
    @POST
    @Path("/dossiers")
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
            public Response createIndividualCHDossier(@NotNull  String provider,  @NotNull String externalId, SobDossier sobDossier) {
        if (StringUtils.isBlank(provider) || StringUtils.isBlank(externalId) || sobDossier == null) {
          return Response.status(Status.BAD_REQUEST).entity(new ResponseExceptionMessage()
                .errorCode(DossierCreationServiceExceptionType.BAD_REQUEST.getUniqueCode().toString())
                .message("Invalid params")).build();
      }
        return new CreateDossierHandlerService().createIndividualCHDossier(provider, externalId, sobDossier);
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And here is the way we trigger subprocess from service:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SubProcessCallResult callResult = SubProcessCall.withPath(CREATE_DOSSIER_HANDLER_PROCESS_NAME)
                    .withStartSignature("createDossier(String,String,SobDossier)")
                    .withParam(PARAM_PROVIDER, provider).withParam(PARAM_EXTERNAL_ID, externalId)
                    .withParam(PARAM_SOB_DOSSIER, sobDossier)
                    .call();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;My Question: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Is it a good solution to go? I actually can't call ivy.repo() inside my service. How can we prevent this kind of zomebie task?&lt;/li&gt;
&lt;li&gt;If we can't prevent zombie task, how ivy handle this kind of task? Does ivy clean it up automatically?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Thanks all&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2932/zombie-task-is-created-after-finishing-callable-subprocess-how-to-avoid-it" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 30 Jul 2024 09:30:01 -0000</lastBuildDate></channel></rss>