-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JBPM-10197] Handle TimerMappingInfo in error scenarios #2335
Conversation
476aa4c
to
f74a8e3
Compare
// this situation needs to be avoided as it should not happen | ||
if (TRANSACTIONAL) { | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can lead to duplicate timers, eg. during process instance migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I removed transactional check. If ejbTimer is null, it is impossible to remove the job, so the method should return false regardless the transactional status, isnt it?
...b/jbpm-services-ejb-timer/src/main/java/org/jbpm/services/ejb/timer/EjbSchedulerService.java
Outdated
Show resolved
Hide resolved
@fjtirado I tested this PR with the following use case:
Findings: If I remove the throw calls in getEjbTimer method, I can see that the TimerMappingInfo gets recreated, which is what I expected. However, it is missing important information, such as the external id and the info column: Old TimerMappingInfo entry:
New TimerMappingInfo entry:
|
e410bd9
to
b8d936a
Compare
@martinweiler I think the behaviour you are experiencing (empty externalid and info) is essentially the same that will occur without the patch. |
SonarCloud Quality Gate failed. 0 Bugs 56.6% Coverage Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
} | ||
} catch (InvalidEJBTimer ex) { | ||
logger.info( | ||
"Avoiding searching all timers since the timer mapping info pointed to a timer that is not longer valid"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to have this logged at debug level and also have the jobName added so that the message provides more context
} catch (Exception e) { | ||
logger.warn("wast not able to deserialize info field from timer info for uuid"); | ||
logger.warn("Error {} objetining the timer handle for timermappinginfo {}", e.getMessage(), | ||
timerMappingInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obtaining (?)
I try Martin approach to generate the problem. Definitely, PUT timers when there're two timers active id 1 and id 2, editing id 2 removes from database timer id 1 and id 2 and id 3 refer to second timer but as this was detected on RHPAM 7.12.1, and customer do not have RHPAM-4192 fix, I get a null listing timers again. I cannot find another action that removes the timer from database, while keeping it in process instance memory. JBPM-10198 should fix that so if that's the only source for "corrupt" a timer that will not happen again. Then this code is defensive for any situation where timer is removed from database. This is: If there's a timermappinginfo, but timer cannot be retrieved, there's an error so do not look for timer in table, just create another one. In that sense, code to deal with an error should not be merged, so that's why I offer the alternative PR #2351 If search for timer is not a blocker like implementing https://issues.redhat.com/browse/EAPSUP-1336 (add a column with external id from app using EJB timers) we can ignore this too as search will be really quick. Just to make it easy to understand:
This is a query that search in milliseconds what timer is related with what timerID created in RHPAM, but is a hack, we want EJB timers to offer this as a feature |
@mareknovotny can we agreed to over #2351 as a solution for customer with this problems instead of this defensive code? |
not mine decision, @krisv @fjtirado @martinweiler @gmunozfe are reviewers |
Im closing this one, will open a new one with alternative approach |
Thank you for submitting this pull request
JIRA: (please edit the JIRA link if it exists)
link