Open artemistomaras opened 7 years ago
That's very interesting, thanks for such a detailed report, I'll try to have a look at it in the upcoming days and see what's causing this.
Thank you.
Anyway, if you require any more information, more details, I am happy to provide them. I'm sure though that you have been able to reproduce that weird behavior by now. If not, let me know.
I failed to reproduce the issue.
I created a django project from scratch with one app, added your model to models.py, partitioned it, then created a view and added a Measurement.objects.create(....)
to it, everything worked perfectly fine. Can you try to do the same and if that works, then there should be some other library/code that is causing this behaviour.
Ah, no wait, I reproduced it, I have to call the view several times and then I was able to reproduce it.
Apologies for being silent, I'm busy with a lot of other stuff at the moment, the quick fix you can make for now is to set the CONN_MAX_AGE
to None
in your settings.py
which will make Django to use persistent connections (docs) and the error will go away.
In the meantime I have to come up with a proper connection handling for Django to fix this error ones and for all.
Thank you for your time and your quick workaround.
Well, persistent connections will involve another issue - MySQL by default has a 8 hours timeout for every connection. So if our persistent connections keep for over 8 hours, the next query will raise a MySQL server has gone away
error.
I'm seeing a recurrence of this issue.
I'm seeing a recurrence of this issue.
Django==3.0.7
Python Version: 3.5 Architect Version: 0.5.5 (same with 0.5.6) Django Version: 1.10.5 Mysql Version: 5.7.16 ( also tested with 5.7.18) mysqlclient Version: 1.3.9 (same with 1.3.10) Operating System: Windows 7 64bit (also tested on Ubuntu 16.04 LTS docker image)
My model:
I have made sure that architect partition command is run beforehand.
I am getting the following error when I try to create an Measurement objects in any of my views:
The problem exists when invoking object creation in any of the two ways:
and the creation is performed in any of my views, or a celery task. When I create the object via the shell (by running python manage.py shell ...) the object is created with no problem. More specifically:
Windows 7 (mysql 5.7.16)
Object creation in a view : fails Object creation in a celery task: succeeds Object creation via the shell: succeeds
Ubuntu 16.04 LTS docker image ( mysql 5.7.18)
Object creation in a view : fails Object creation in a celery task: fails Object creation via the shell: succeeds