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

[BUG] SqlStorageProvider assumes that all DataSources are autoCommit enabled. #128

Closed
tan9 opened this issue May 25, 2021 · 5 comments · Fixed by #129
Closed

[BUG] SqlStorageProvider assumes that all DataSources are autoCommit enabled. #128

tan9 opened this issue May 25, 2021 · 5 comments · Fixed by #129

Comments

@tan9
Copy link
Contributor

tan9 commented May 25, 2021

Describe the bug
If dataSource.autoCommit was set to false, various database operation failed due to changes not been committed.

We are using JHipster to generate our application, and the default Hikari configuration of auto-commit is false.

Environment
I'm using version: 2.0.1
I'm running on: JDK 8
I'm using the following StorageProvider: SQLServerStorageProvider

To Reproduce

Test cases here: tan9@3859c56

Expected behavior
JobRunr managed its transaction automatically, not dependents on DataSource configuration.

Additional context
Maybe related to: #106

@tan9 tan9 changed the title [BUG] SqlStorageProvider assumes that `DataSources are all autoCommit enabled. [BUG] SqlStorageProvider assumes that all DataSources are autoCommit enabled. May 25, 2021
@tan9
Copy link
Contributor Author

tan9 commented May 25, 2021

kagkarlsson/db-scheduler#204 has similar issue.

@rdehuyss
Copy link
Contributor

Wauw, thanks for the detailed report and PR - I indeed did not think about this.

@tan9
Copy link
Contributor Author

tan9 commented May 26, 2021

@rdehuyss I can confirm that this is the root cause of "No servers available?!" issues.

My colleague encountered following exception while integrating JobRunr into our JHipster genereated app:

org.jobrunr.JobRunrException: JobRunr encountered a problematic exception. Please create a bug report (if possible, provide the code to reproduce this and the stacktrace)
    at org.jobrunr.JobRunrException.shouldNotHappenException(JobRunrException.java:33)
    at org.jobrunr.storage.sql.common.BackgroundJobServerTable.lambda$getLongestRunningBackgroundJobServerId$3(BackgroundJobServerTable.java:110)
    at java.util.Optional.orElseThrow(Optional.java:290)
    at org.jobrunr.storage.sql.common.BackgroundJobServerTable.getLongestRunningBackgroundJobServerId(BackgroundJobServerTable.java:110)
    at org.jobrunr.storage.sql.common.DefaultSqlStorageProvider.getLongestRunningBackgroundJobServerId(DefaultSqlStorageProvider.java:92)
    at org.jobrunr.storage.ThreadSafeStorageProvider.getLongestRunningBackgroundJobServerId(ThreadSafeStorageProvider.java:63)
    at org.jobrunr.server.ServerZooKeeper.determineIfCurrentBackgroundJobServerIsMaster(ServerZooKeeper.java:98)
    at org.jobrunr.server.ServerZooKeeper.announceBackgroundJobServer(ServerZooKeeper.java:66)
    at org.jobrunr.server.ServerZooKeeper.run(ServerZooKeeper.java:40)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: No servers available?!
    ... 17 common frames omitted

Just same as #106 and https://stackoverflow.com/questions/67436856/spring-boot-jobrunr-no-servers-available-error .

I think release a new version to public with this fix will greatly help users first get in touch with JobRunr 🚀

@rdehuyss
Copy link
Contributor

@tan9 Thanks for your nice feedback! I'm doing a small refactoring to aid the development of new features and will hopefully release soon. I'll keep you posted!

@rdehuyss
Copy link
Contributor

@tan9 Solved with the release of JobRunr 3.0.0. It should arrive soon in Maven Central.

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

Successfully merging a pull request may close this issue.

2 participants