-
Notifications
You must be signed in to change notification settings - Fork 882
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]: Deadlock when concurrently updating a hypertable linked to ordinary tables (might be linked to #5342 ) #7429
Comments
Thanks for the script, I can reproduce the problem. |
Slightly simplified the script. Might be related to this issue we have on a private repo: https://github.com/timescale/eng-database/issues/619 |
Seems to be related to creating the FK constraint for a new chunk:
|
It doesn't seem to happen if the inserts go to an already created chunk, e.g. if I run one |
Noted the same behaviour. As a temp workaround is there a way to pre-create chunks before inserting data? |
@akuzm Hi, any idea if there would be a workaround for this? |
What type of bug is this?
Locking issue
What subsystems and features are affected?
Query executor
What happened?
We are hitting a deadlock when we are inserting data concurrently in a database structure similar to the example below.
The issue occurs pretty much instantly when concurrency is introduced. If we drop triggers or foreign references the deadlock does not occur. It seems that this issue might be related to #5342 , but needs further analysis.
I created a shell script to replicate the issue. The script creates the database and structure below and runs concurrent testing. In my tests the deadlock occurs 100% time.
https://github.com/timopulkkinen/tsdb-concurrent-deadlock
TimescaleDB version affected
2.17.2
PostgreSQL version used
16
What operating system did you use?
MacOS 14.6.1 ARM
What installation method did you use?
Docker
What platform did you run on?
On prem/Self-hosted
Relevant log output and stack trace
How can we reproduce the bug?
1. Clone the Github repo 2. Run the test script (set PGUSER, PGPASSWORD and other relevant env vars before) 3. The error should manifest itself.
The text was updated successfully, but these errors were encountered: