Comments (8)
pushed the fix the master branch:
77118ef
from jsr352.
At step 7, you are restarting the job execution (jobExecution2) that was stopped at step 6 on server B. jobExecution2 is different than the one that you started at step 1 on server A. So jobExecution2 is not cached in server A.
I think at step 7, JBeret is getting the right job execution (jobExecution2) from db. But the retrieval of jobExecution2 from db does not include its constituent step executions. So JBeret mistakenly uses the obsolete step execution from jobExecution1.
from jsr352.
The fix should be something like this:
diff --git a/jberet-core/src/main/java/org/jberet/repository/AbstractPersistentRepository.java b/jberet-core/src/main/java/org/jberet/repository/AbstractPersistentRepository.java
index 661ec7f..45ea516 100644
--- a/jberet-core/src/main/java/org/jberet/repository/AbstractPersistentRepository.java
+++ b/jberet-core/src/main/java/org/jberet/repository/AbstractPersistentRepository.java
@@ -168,7 +168,12 @@ public abstract class AbstractPersistentRepository extends AbstractRepository im
public StepExecutionImpl findOriginalStepExecutionForRestart(final String stepName,
final JobExecutionImpl jobExecutionToRestart,
final ClassLoader classLoader) {
- for (final StepExecution stepExecution : jobExecutionToRestart.getStepExecutions()) {
+ List<StepExecution> stepExecutions = jobExecutionToRestart.getStepExecutions();
+ if (stepExecutions.isEmpty()) {
+ stepExecutions = getStepExecutions(jobExecutionToRestart.getExecutionId(), classLoader);
+ }
+
+ for (final StepExecution stepExecution : stepExecutions) {
if (stepName.equals(stepExecution.getStepName())) {
return (StepExecutionImpl) stepExecution;
}
the above diff is based on the master branch, so the line numbers may be different for 1.2.0.
from jsr352.
Can you try the above patch in your app? I'll set up a similar test scenario but will not identical as yours.
Which version of WildFly are you using?
from jsr352.
Cloned this issue in JIRA: JBERET-285
https://issues.jboss.org/browse/JBERET-285
from jsr352.
In fact, JdbcRepository (a subclass of AbstractPersistentRepository) already overrides findOriginalStepExecutionForRestart
method to retrieve the original failed/stopped step from db, but it calls super.findOriginalStepExecutionForRestart
first in hope of finding the right step from cache to save db access cost. In this case, the cache happens to contain an oboselete step by the same name. I think the following fix should also work, and I will research more to see which one is better.
/Users/cfang/dev/jsr352 > git diff -U10
diff --git a/jberet-core/src/main/java/org/jberet/repository/AbstractPersistentRepository.java b/jberet-core/src/main/java/org/jberet/repository/AbstractPersistentRepository.java
index 661ec7f..0ff853f 100644
--- a/jberet-core/src/main/java/org/jberet/repository/AbstractPersistentRepository.java
+++ b/jberet-core/src/main/java/org/jberet/repository/AbstractPersistentRepository.java
@@ -166,31 +166,13 @@ public abstract class AbstractPersistentRepository extends AbstractRepository im
@Override
public StepExecutionImpl findOriginalStepExecutionForRestart(final String stepName,
final JobExecutionImpl jobExecutionToRestart,
final ClassLoader classLoader) {
for (final StepExecution stepExecution : jobExecutionToRestart.getStepExecutions()) {
if (stepName.equals(stepExecution.getStepName())) {
return (StepExecutionImpl) stepExecution;
}
}
- StepExecutionImpl result = null;
- // the same-named StepExecution is not found in the jobExecutionToRestart. It's still possible the same-named
- // StepExecution may exit in JobExecution earlier than jobExecutionToRestart for the same JobInstance.
- final long instanceId = jobExecutionToRestart.getJobInstance().getInstanceId();
- for (final SoftReference<JobExecutionImpl, Long> e : jobExecutions.values()) {
- final JobExecutionImpl jobExecutionImpl = e.get();
- //skip the JobExecution that has already been checked above
- if (jobExecutionImpl != null && instanceId == jobExecutionImpl.getJobInstance().getInstanceId() &&
- jobExecutionImpl.getExecutionId() != jobExecutionToRestart.getExecutionId()) {
- for (final StepExecution stepExecution : jobExecutionImpl.getStepExecutions()) {
- if (stepExecution.getStepName().equals(stepName)) {
- if (result == null || result.getStepExecutionId() < stepExecution.getStepExecutionId()) {
- result = (StepExecutionImpl) stepExecution;
- }
- }
- }
- }
- }
- return result;
+ return null;
}
}
from jsr352.
Thank you for your responses, I am happy you identified the source of the issue. However, I am not able to test the patch right now. I am using Wildfly 9.0.0.
from jsr352.
I was able to reproduce the problem, using wildfly-jberet-samples/deserialization/, with slight modifications, deployed to 2 server a and server b.
from jsr352.
Related Issues (20)
- gulp build doesn't exit HOT 4
- NoSuchJobException HOT 8
- Need to update the link to JSR 352 spec project in README.md HOT 1
- If the server is using other timezone the JDBC repository will show wrong time. HOT 7
- According JBeret specification JBeret should be able to @Inject @BatchProperty File file, but it works only in special curcumstance. HOT 2
- Checkpoints must be set after skipped item HOT 5
- JBERET000640 - Wildfly 14 HOT 13
- Does JBeret support Java11? HOT 3
- Usage of JBoss Marshalling incompatible with native compilation with GraalVM HOT 8
- Jberet and Thorntail HOT 2
- Inconsistent BatchStatus after database connection loss HOT 1
- Support additional Serialization mechanisms
- jberet-camel reading only one file HOT 2
- Mongo support for storing batch metadata? HOT 2
- PurgeBatchlet doesn't work with JdbcJobRepository HOT 2
- "JBERET000651: The requested permits (%d) is greater than the maximum number of permits (%d) allowed in the thread pool."; HOT 2
- user guide HOT 2
- Support Java 17 HOT 10
- Injection of batch artifact properties does not work HOT 10
- Job versioning does not appear to be supported in JBeret HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsr352.