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

Encountering deadlocks when uploading advisories #999

Open
JimFuller-RedHat opened this issue Nov 13, 2024 · 3 comments
Open

Encountering deadlocks when uploading advisories #999

JimFuller-RedHat opened this issue Nov 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@JimFuller-RedHat
Copy link
Collaborator

JimFuller-RedHat commented Nov 13, 2024

on latest master - after uploading (via ux) etc/test-data/csaf/* I see the following errors

2024-11-13T15:39:16.521222Z ERROR ThreadId(52) trustify_module_ingestor::service::advisory::csaf::loader: error=Query Error: error returned from database: deadlock detected
2024-11-13T15:39:16.523532Z ERROR ThreadId(52) trustify_module_ingestor::service: error=Query Error: error returned from database: deadlock detected

accompanied by some slow warnings:

2024-11-13T15:42:43.699888Z  WARN ThreadId(55) sqlx::query: slow statement: execution time exceeded alert threshold summary="UPDATE \"organization\" SET \"cpe_key\" …" db.statement="\n\nUPDATE\n  \"organization\"\nSET\n  \"cpe_key\" = $1,\n  \"website\" = $2\nWHERE\n  \"organization\".\"id\" = $3\nRETURNING\n  \"id\",\n  \"name\",\n  \"cpe_key\",\n  \"website\"\n" rows_affected=0 rows_returned=1 elapsed=12.21970387s elapsed_secs=12.21970387 slow_threshold=1s
@helio-frota
Copy link
Collaborator

helio-frota commented Nov 13, 2024

Good catch I saw the same I reproduced it here and this the log

I thought this clone was hiding a bug after I removed it. But I added it back and saw 2 deadlocks

@helio-frota
Copy link
Collaborator

helio-frota commented Nov 14, 2024

I found the point when/where the message changes:

  • Query Error: error returned from database: duplicate key value violates unique constraint "package_pkey"
    commit 7f57a81

  • Query Error: error returned from database: deadlock detected
    commit 47be914

dblog.txt

and for this I copy *.json from trustify/etc/test-data/csaf/ cloned in another directory to trustify/etc/test-data/csaf/ of these commits and then select all and upload.

@helio-frota helio-frota added the bug Something isn't working label Nov 15, 2024
helio-frota added a commit to helio-frota/trustify that referenced this issue Nov 15, 2024
helio-frota added a commit to helio-frota/trustify that referenced this issue Nov 15, 2024
@helio-frota
Copy link
Collaborator

when I comment this for loop, the test pass

running 1 test
test advisory::endpoints::test::upload_default_csaf_format_multiple_parallel ... ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants