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

Error log at startup with @SchedulerLock #1317

Closed
Epiliptik opened this issue Jan 18, 2023 · 3 comments
Closed

Error log at startup with @SchedulerLock #1317

Epiliptik opened this issue Jan 18, 2023 · 3 comments

Comments

@Epiliptik
Copy link

Hello,

I have several spring applications using an Oracle database with shedlock 4.44.0 and JdbcTemplateLockProvider.

I have a task @scheduled running with @SchedulerLock(name="Task_lock_name")

Everything is working fine until I restart the app, I have a few logs like that :

2023-01-18T18:48:00.106 ERROR [3-thread-1]                       jdbc.sqltiming                 1. PreparedStatement.executeUpdate() FAILED! INSERT INTO <SCHEMA>.shedlock(name, lock_until, locked_at, locked_by) VALUES('Task_lock_name',

to_timestamp('01/18/2023 18:58:00.019', 'mm/dd/yyyy hh24:mi:ss.ff3'), to_timestamp('01/18/2023

18:48:00.045', 'mm/dd/yyyy hh24:mi:ss.ff3'), 'CH001')

 {FAILED after 26 msec}

java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (<SCHEMA>.SYS_C0081639) violated

It tries to insert a line in the shedlock table with the scheduling lock name but there is already one and the name is the primary key.

After a bit of time everything start to work fine but the error logs at the startup are polluting the logs.

Is this a bug or is there a way to fix it?

As far as I remember it was working fine with 4.33.0, the problem appeared after.

Thanks.

@lukas-krecan
Copy link
Owner

Hi, I assume it's logged by the JDBC driver, is that correct? It's how ShedLock works and always had. See for example similar issue #1123.

In DBs that have reliable UPSERT we already switched to that, for Oracle there does not seem to be a good way to fix that.

@Epiliptik
Copy link
Author

Yes it comes from the jdbc audit. Looks like there is no easy way to do it with oracle. So not much I can do as the log comes from the audit and not from shedlock if I understand correctly? Appart from deactivating the jdbc logs but that would not be great either.

@lukas-krecan
Copy link
Owner

If you want to, you can try to use merge https://stackoverflow.com/a/2692441/277042 in OracleServerTimeStatementsSource and if the tests pass, send a PR. Unfortunately, I do not have capacity to do it myself.

xmjosic pushed a commit to xmjosic/ShedLock that referenced this issue Sep 14, 2023
lukas-krecan added a commit that referenced this issue Sep 14, 2023
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