Skip to content
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

Propagation Behavior defaulting to REQUIRES_NEW causing transaction issues. #1076

Open
cday2 opened this issue Jun 21, 2022 · 4 comments
Open

Comments

@cday2
Copy link

cday2 commented Jun 21, 2022

Is your feature request related to a problem? Please describe.
Yes, because you are doing transactionTemplate.setPropagationBehavior to REQUIRES_NEW in JdbcTemplateStorageAccessor constructor we have code that has an @transactional and does not update the DB in certain cases.

Describe the solution you'd like
Make it configurable via the Configuration. We needed PROPAGATION_REQUIRED to avoid transaction issues.

Describe alternatives you've considered
Maybe even rethink it and change it to PROPAGATION_REQUIRED I bet others run into this issue. We are using your shedlock not just for scheduled jobs but for system level locks.

Additional context

image

@lukas-krecan
Copy link
Owner

Hi, thanks for feedback. Feel free to send a pull request. Out of curiosity, can you please elaborate on the issues it causes?

@cday2
Copy link
Author

cday2 commented Jun 22, 2022 via email

@cday2
Copy link
Author

cday2 commented Jun 22, 2022 via email

@lukas-krecan
Copy link
Owner

lukas-krecan commented Nov 21, 2022

Hi, I am thinking about implementing it. Let's say we have 3 DB operations

  1. ShedLock update to obtain the lock
  2. A DB operation inside the locked method
  3. ShedLock update to release the lock

Currently, thanks to REQUIRES_NEW the operations are isolated. If we change the behavior, an error when executing 2. would rollback 1. Is this what you want? Do you want a failure in ulocking 3. to rollback the DB operation in 2.? What do you expect to happen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants