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

Fix deadlock for Sanic apps with generate_schema=True and > 1 workers #1696

Merged
merged 5 commits into from
Aug 17, 2024

Conversation

Pirulax
Copy link
Contributor

@Pirulax Pirulax commented Aug 11, 2024

Description/Motivation and Context

Fixes deadlock caused by multiple workers trying to initialize the schema at the same time.
In my case this deadlock was caught by asyncpg.
I did try making a minimum repro sample, but failed, and honestly, don't have the time to fiddle with it.
I can't post my app, as it's private.

How Has This Been Tested?

I ran it in my own app where the deadlock previously occurred, now it doesn't and the schema is created as expected.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Pirulax Pirulax changed the title Fix deadlock for Sanic apps with generate_schema=True Fix deadlock for Sanic apps with generate_schema=True and 1< workers Aug 11, 2024
@Pirulax Pirulax changed the title Fix deadlock for Sanic apps with generate_schema=True and 1< workers Fix deadlock for Sanic apps with generate_schema=True and > 1 workers Aug 11, 2024
@abondar
Copy link
Member

abondar commented Aug 14, 2024

Hi!

Please run make lint to see lint errors

@Pirulax
Copy link
Contributor Author

Pirulax commented Aug 14, 2024

Hello,
Not sure if there are docs of this somewhere, but on Windows both make lint and make style fails out of the box.
I had to manually install black and isort using pipx.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 10393052714

Details

  • 0 of 9 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.07%) to 89.021%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tortoise/contrib/sanic/init.py 0 9 0.0%
Totals Coverage Status
Change from base Build 10244831838: -0.07%
Covered Lines: 5960
Relevant Lines: 6580

💛 - Coveralls

@abondar abondar merged commit 60c225e into tortoise:develop Aug 17, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

3 participants