François, Thanks for the offer, however I will be trying to change to mysqlclient instead of the mysql-connector-python connector. I can only do this by releasing to our production servers, which will not be until Tuesday. So unfortunately I will have to wait until then.
Regards, Andréas 2014-12-05 14:19 GMT+01:00 François Schiettecatte <fschietteca...@gmail.com> : > Andreas > > I have had to use this workaround for scripts that run a long time between > database accesses: > > from django.db import connection > > def checkConnection(): > > # Check the connection, close if needed > try: > connection.connection.ping() > # print 'INFO: connection.connection.ping()' > except: > connection.close() > # print 'INFO: connection.close()' > > > Call checkConnection() before you do a database access, you may need to > play around with where you put this. The code I have is crawler which uses > the django models to add data to a database, so a lot of time elapses > between the start of the script and when the data is actually inserted into > the database, so plenty of time for connections to time out. > > I spent a while tracking this down a while back but was not able to fully > sort out the issue, I came away with the impression that there was a bug > somewhere in the connection pool code. If you like I have a little spare > time today and can dig into this again. > > François > > > > On Dec 5, 2014, at 4:08 AM, Andreas Kuhne <andreas.ku...@suitopia.com> > wrote: > > > > Hi Collin, > > > > Thanks! > > > > I tried the CONN_MAX_AGE setting and it didn't work. We still get > problems, so I'll have to try changing the connector. The only thing left I > think. > > > > Regards, > > > > Andréas > > > > 2014-12-05 5:07 GMT+01:00 Collin Anderson <cmawebs...@gmail.com>: > > Hi Andréas, > > > > If it helps, mysqlclient (python3-compatible fork of mysqldb) is > Django's recommended connector/driver. > > > > https://pypi.python.org/pypi/mysqlclient > > > https://docs.djangoproject.com/en/dev/ref/databases/#mysql-db-api-drivers > > > > Collin > > > > > > On Thursday, December 4, 2014 1:50:09 PM UTC-5, Andréas Kühne wrote: > > Hi all, > > > > We went live with a new website, completely rewritten in python 3 and > with django 1.6 (upgrade to 1.7 is in progress) on November the 18th. Of > course there were some minor issues, but most of them have been resolved > and so far everything is working really nice. > > > > HOWEVER... We are having major issues with the mysql-connector-python > pip package. We are running the latest stable version (2.0.2), but it seems > as if the connector looses it's connection every now and then. This is > really irritating as it can happen 10-15 times / day. This means that a lot > of our customers are probably having problems. The exception we are getting > is: > > mysql.connector.errors.InterfaceError: 2013: Lost connection to MySQL > server during query > > > > We are running on AWS with a RDS instance for the mysql server. This > worked perfectly in our previous configuration with python 2.7 and the > mysqldb connector. > > > > Is mysql-connector-python not ready for a production system? Is there > anyone else who has had the same problems? > > > > Is there any other python 3 compatible connector that we can use > instead? We are also using south, so it has to be compatible with south as > well. > > > > Regards, > > > > Andréas > > > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to django-users+unsubscr...@googlegroups.com. > > To post to this group, send email to django-users@googlegroups.com. > > Visit this group at http://groups.google.com/group/django-users. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/8283294e-2d8d-487c-9bb1-f96c06ef46a5%40googlegroups.com > . > > > > For more options, visit https://groups.google.com/d/optout. > > > > > > -- > > You received this message because you are subscribed to the Google > Groups "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to django-users+unsubscr...@googlegroups.com. > > To post to this group, send email to django-users@googlegroups.com. > > Visit this group at http://groups.google.com/group/django-users. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CALXYUbmPrpEwHbrNn29HQ_%2BtDGYgeCdeV9PqyikJLq9C-V2zdQ%40mail.gmail.com > . > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/D2E85288-5BD9-4C78-92BC-474EEF82E6C9%40gmail.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALXYUbkMmrGhTYqdrzUTTozR7XxJWtf%2BVa4ErFWetPj4CxH3SA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.