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

ShedLock does not work with PostgreSQL JDBC Driver version 42.2.11 #207

Closed
kerdotnet opened this issue Mar 19, 2020 · 8 comments
Closed

Comments

@kerdotnet
Copy link

kerdotnet commented Mar 19, 2020

  1. Which version do you use
    shedlock-spring:4.5.1
  2. Which Lock Provider
    shedlock-provider-jdbc-template:4.5.1
  3. ShedLock configuration
    lockAtLeastFor = "PT10S",
    lockAtMostFor = "PT120S"

Expected behavior
Shedlock can start without errors

Actual behavior
After an update on the latest PostgreSQL JDBC Driver JDBC 4.2 » 42.2.11 and deployment we found that Shedlock can not start because of error:

org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is org.postgresql.util.PSQLException: The database returned ROLLBACK, so the transaction cannot be committed. Transaction failure cause is <<ERROR: duplicate key value violates unique constraint "shedlock_pkey"
  Detail: Key (name)=(documentProcessingJob) already exists.>>
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:334)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:744) 
@lukas-krecan
Copy link
Owner

Thanks for reporting, it's indeed the case. Will take a look at it.

@lukas-krecan
Copy link
Owner

Caused by pgjdbc/pgjdbc#1729

@lukas-krecan
Copy link
Owner

Can be fixed by setting raiseExceptionOnSilentRollback=false connection property. Frankly, I think it's a bug in Postgres SQL driver and I will wait before considering implementing a workaround.

@kerdotnet
Copy link
Author

Thanks for the information!

@davecramer
Copy link

This is NOT. bug in the driver. This was done on purpose as the SQL Standard requires that errors be thrown if the transaction cannot be committed

@lukas-krecan
Copy link
Owner

Fixed in 4.5.2

@pavel-kiper
Copy link

pavel-kiper commented Apr 3, 2020

I am just going to leave some keywords here for someone googling this issue in future:

ShedLock, Spring boot upgrade, PostgreSQL.

We have upgraded Sprint Boot from v2.1 to v2.2 and got

Detail: Key (name)=(myclass_mymethod) already exists.>>
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:335)
...
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "shedlock_pkey"
  Detail: Key (name)=(myclass_mymethod) already exists.
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2578)
...
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)

@davecramer
Copy link

FWIW PgJDBC 42.2.12 has been released and this change has been reverted. We (the PgJDBC group are recommending that 42.2.11 not be used and use 42.2.12 instead.
Also note that we will be releasing 42.3.0 with the above mentioned change.

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

4 participants