Announcement Announcement Module
Collapse
No announcement yet.
ItemWriter with Unix process is hanging Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ItemWriter with Unix process is hanging

    So we have a itemwriter that spawns a Unix curl process to download a result from a REST service into a file. This writer waits for the process to complete before proceeding to the next step. This step with this writer worked fine but suddenly stopped running/hanging without any changes from our end. So the job starts and never comes out of the UNIX process. When we do a process check (ps -eaf|grep "curl") it shows the curl process running. We checked the following:
    ** REST service is responding and works fine.
    ** Wrote a simple java class doing the same thing which also works fine.

    So we took a thread dump to see the below entry for SimpleAsyncTaskExecuter-2

    Did anyone else have this same issue? We are not sure if this is related to Spring batch but cannot think of anything as this hangs only when part of batch processing.

    Any inputs on how to get further information would be great. We use java version "1.6.0_11" and the job is running on jboss 4.2.3

    "SimpleAsyncTaskExecutor-2" prio=10 tid=0x092c9800 nid=0x2afe in Object.wait() [0x72a63000..0x72a63f20]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at java.lang.UNIXProcess.waitFor(UNIXProcess.java:165 )
    - locked <0x7aa29a60> (a java.lang.UNIXProcess)
    at com.msc.batch.RESTResponseFileItemWriter.write(RES TResponseFileItemWriter.java:38)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.writeItems(SimpleChunkProcessor.java:1 56)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.doWrite(SimpleChunkProcessor.java:137)
    at org.springframework.batch.core.step.item.FaultTole rantChunkProcessor$3.doWithRetry(FaultTolerantChun kProcessor.java:302)
    at org.springframework.batch.retry.support.RetryTempl ate.doExecute(RetryTemplate.java:238)
    at org.springframework.batch.retry.support.RetryTempl ate.execute(RetryTemplate.java:187)
    at org.springframework.batch.core.step.item.BatchRetr yTemplate.execute(BatchRetryTemplate.java:213)
    at org.springframework.batch.core.step.item.FaultTole rantChunkProcessor.write(FaultTolerantChunkProcess or.java:389)
    at org.springframework.batch.core.step.item.SimpleChu nkProcessor.process(SimpleChunkProcessor.java:178)
    at org.springframework.batch.core.step.item.ChunkOrie ntedTasklet.execute(ChunkOrientedTasklet.java:74)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$ChunkTransactionCallback.doInTransaction(Tas kletStep.java:347)
    at org.springframework.transaction.support.Transactio nTemplate.execute(TransactionTemplate.java:130)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:261)
    at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:76)
    at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:367)
    at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:214)
    at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143)
    at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(TaskletStep.java:247)
    at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:196)
    at org.springframework.batch.core.job.SimpleStepHandl er.handleStep(SimpleStepHandler.java:115)
    at org.springframework.batch.core.job.flow.JobFlowExe cutor.executeStep(JobFlowExecutor.java:61)
    at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:99)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:281)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:120)
    at java.lang.Thread.run(Thread.java:619)

  • #2
    I couldn't say why the UNIX process is hanging (or rather why the JVM is hanging waiting for it). It seems like a complicated solution and quite inefficient though. Why not use RestTemplate in your Java process to access the resource?

    Comment

    Working...
    X