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 postgresql isolation level #6569

Merged

Conversation

30350n
Copy link
Contributor

@30350n 30350n commented Feb 25, 2024

So after fixing my deployment again, I was getting a whole bunch of django.db.utils.OperationalError: could not serialize access due to concurrent update errors which also made the interface feel noticeably sluggish (things would straight up not load ~50% of the time).

Looking at the existing issues regarding that error, this seems to be caused by the postgresql isolation level setting being set to ISOLATION_LEVEL_SERIALIZABLE, which seems to have been messed up during the switch to Django 4 in #6173.

I tested this patch on my production server and by clicking through random pages furiously for 2 minutes and didn't get any further errors (before there were sometimes multiple when visiting a single page).

Copy link

netlify bot commented Feb 25, 2024

Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit f390857
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/65db6b566cec2a00080c1c70

@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed setup Relates to the InvenTree setup / installation process labels Feb 25, 2024
@SchrodingersGat
Copy link
Member

@30350n thanks for giving attention to this :)

@SchrodingersGat SchrodingersGat merged commit a3dc3bd into inventree:master Feb 25, 2024
24 checks passed
@SchrodingersGat SchrodingersGat added this to the 0.14.0 milestone Feb 25, 2024
@SchrodingersGat
Copy link
Member

@SchrodingersGat
Copy link
Member

Ok, we recently moved away from psycopg2 module. It is now psycopg that needs to be imported. Not sure how the initial tests passed here

@30350n
Copy link
Contributor Author

30350n commented Feb 25, 2024

Hmm, I checked and it wasn't part of the dependencies before #6173 either.

@30350n
Copy link
Contributor Author

30350n commented Feb 25, 2024

And the deployment docs mention that you should install it, so I figured that'd be the way to go.

@30350n
Copy link
Contributor Author

30350n commented Feb 25, 2024

Also seems like Django 4 requires psycopg2.

@matmair
Copy link
Member

matmair commented Feb 25, 2024

@30350n they call out that they are switching away in the release notes https://docs.djangoproject.com/en/5.0/releases/4.2/#what-s-new-in-django-4-2 so depending on v2 instead of v3 will probably be a problem in the future

@matmair
Copy link
Member

matmair commented Feb 25, 2024

we are on 4.2 so these are the supported/recommended engines https://docs.djangoproject.com/en/4.2/ref/databases/#postgresql-notes

@30350n
Copy link
Contributor Author

30350n commented Feb 25, 2024

Ah yeah, I was looking at the docs for 4.0 I see, my bad. I'll make another PR to switch to psycopg that also fixes the docs.

@SchrodingersGat
Copy link
Member

Thanks for addressing this so speedily :)

@30350n
Copy link
Contributor Author

30350n commented Feb 26, 2024

No Problem ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies a bug which needs to be addressed setup Relates to the InvenTree setup / installation process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants