tink
tink copied to clipboard
rpc error: code = Unknown desc = COMMIT: pq: could not serialize access due to read/write dependencies among transactions
Expected Behaviour
Tink server should be capable of handling requests in paralell.
Current Behaviour
Currently, when one applies multiple requests to tink server in parallel, server sometimes returns the following error:
Error: removing workflow "08b64643-010d-4ade-a43f-6ffa7f0afce8": rpc error: code = Unknown desc = COMMIT: pq: could not serialize access due to read/write dependencies among transactions
Steps to Reproduce (for bugs)
Currently, this is sometimes reproducible when using https://github.com/kinvolk/terraform-provider-tinkerbell and when running terraform destroy on large number of Tinkerbell resources.
Context
Your Environment
Tested using Tinkerbell sandbox with tinkerbell server from image quay.io/tinkerbell/tink:sha-adb49da.
BTW, in some cases, like https://github.com/tinkerbell/tink/blob/34275668af5eede0475dae8f3aa6d75fe0cf0618/db/template.go#L17-L45, transaction is not even needed, as there is only a single query being made, which is already ensured to be atomic by the database itself, according to https://stackoverflow.com/a/1171807/2974814, unless I'm missing something.
@kdeng3849 looks like what you're looking at right?
@parauliya this is mitigation I talked about: https://github.com/kinvolk/terraform-provider-tinkerbell/commit/d4e4080646d51590944e4f656af2e85f67c85dd6.
@mmlb yeah, that's exactly it
@kdeng3849 what is the status of this?
It has been fixed with this PR: https://github.com/tinkerbell/tink/pull/346
Ah, BTW, this was also occurring for other resources, not only for workflows. I'll test if that's still the case.
This still occurs when workflows are removed:
Error: removing workflow "b06356a8-3ed4-11eb-a31e-0242ac1b0004": rpc error: code = Unknown desc = Delete Workflow Error: pq: could not serialize access due to read/write dependencies among transactions
Error: removing workflow "b05ef9be-3ed4-11eb-a31e-0242ac1b0004": rpc error: code = Unknown desc = COMMIT: pq: could not serialize access due to read/write dependencies among transactions
Error: removing workflow "b046f1ae-3ed4-11eb-a31e-0242ac1b0004": rpc error: code = Unknown desc = COMMIT: pq: could not serialize access due to read/write dependencies among transactions
Running Tinkerbell 266637ae. Can we please re-open?
Creating/deleting Hardware entries and Templates seems OK.
@invidian asked me to re-open, so I think it is not a fixed issue yet
close by https://github.com/tinkerbell/tink/pull/654