Skip to content

Conversation

@6543
Copy link
Member

@6543 6543 commented Sep 21, 2025

closes #5477
fixes #3884

Make race condition save by let other CreatePipeline wait till the current CreatePipeline is done (either committed or errored)

this happens via an table lock inside the database exept for sqlite

@xoxys
Copy link
Member

xoxys commented Sep 21, 2025

@6543 I like this approach. Can you fix lint and tests?

@6543
Copy link
Member Author

6543 commented Sep 21, 2025

the DB error is an xorm issue ... let me look into it - I think it might lead to an upstream fix ;)

@xoxys xoxys mentioned this pull request Sep 23, 2025
16 tasks
@qwerty287 qwerty287 changed the title Aquire write lock for pipeline creation into the database Acquire write lock for pipeline creation into the database Sep 24, 2025
// we have an exclusive lock via createPipelineSQLiteLock already

case schemas.MYSQL:
if _, err := sess.Exec("LOCK TABLE `pipelines` WRITE"); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we cant do that or we dont have support for mariadb cluster

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xoxys
Copy link
Member

xoxys commented Oct 6, 2025

What about the soft-lock approach #5477 (comment) from @lafriks

@6543
Copy link
Member Author

6543 commented Oct 6, 2025

thats how gitea does it and my next aproach ...

@xoxys
Copy link
Member

xoxys commented Oct 6, 2025

Thanks for working on this task!

@qwerty287 qwerty287 marked this pull request as draft October 26, 2025 07:07
@hhamalai
Copy link
Contributor

hhamalai commented Nov 7, 2025

Is this fix being actively worked with @6543 optimistic locking approach? Our builds often fails to start from webhooks due to this issue. Either this or #5477 should be worked to finish to resolve the issue, but which one core maintainers currently prefer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Likely concurrency issue pq: 'duplicate key value violates unique constraint \"UQE_pipelines_s\"'

3 participants