Results 1 to 4 of 4

Thread: OptimisticLockingFailureException when stop the job at its ending stage

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1

    Default OptimisticLockingFailureException when stop the job at its ending stage

    I have a spring batch job running in asynchronous mode and issue the stop operation through JobOperator in a virgo OSGi container. OptimisticLockingFailureException can be thrown if the job is at the last moment to update the JobExecution status to COMPLETED because it detects the version conflicts.

    I noticed two related Jira issues were opened.
    https://jira.springsource.org/browse/BATCH-954
    https://jira.springsource.org/browse/BATCHADM-135

    The first issue had been resolved since 2.0.0.M4 but I am using 2.1.8.RELEASE.
    The second issue reported similar problem when the job is at STARTING status. It is still open.

    Is my problem a valid issue? Any solution already? Thanks.

    Robert commented in BATCH-954 back in 2008
    "JobOperator works with its own copy of JobExecution therefore the version mismatch between job's and jobOperators' version is inevitable. This issue fixed the obvious problem (when jobOperator updates the status, job's version becomes obsolete), but I think there can still be trouble with race conditions. I want to take a closer look at this in BATCH-961"

    Is this really inevitable? Then what is the best practice to stop a job running asynchronous mode? Thanks again.

  2. #2
    Join Date
    Jan 2013
    Posts
    5

    Default

    Hello, I've got the same problem when trying to stop running batches with the SimpleJobOperator through JMX, as in BATCH-954, in asynchronous mode like weibill, with a 2.1.9.RELEASE.

    Have you got a solution for this, or is it linked to the old bug in BATCH-954?

    Thanks in advance,

    Ben

  3. #3
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    338

    Default

    Do you have a stack trace from that exception or a unit test that reliably recreates it? I may have a solution...

    Either way, a Jira ticket should be opened for this.
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

  4. #4
    Join Date
    Jan 2013
    Posts
    5

    Default

    I created BATCH-1981 for this issue

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •