#31515: Django tries to reuse MySQL connections that have gone away with ASGI
-------------------------------------+-------------------------------------
     Reporter:  Braunson             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  3.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Braunson):

 Replying to [comment:5 Simon Charette]:
 > Thanks for trying it out. It also has bit of similarity with #30398 but
 the fact it only happens with ASGI is puzzling. Could you try setting up a
 minimal project that reproduces your issue to make it easier to identify
 its origin?

 Been working hard to try and reproduce this in a development environment
 but I'm having a hard time. I can see either the timeout must be getting
 reached or there is a packet issue because the logs of our SQL server is
 filled with communication errors on initial packet whenever we hit a 500
 error on the website.

 Additionally (not sure if related) but I am able to reproduce issues with
 unclosed connections when running ASGI:

 {{{
 INFO:     127.0.0.1:58148 - "GET / HTTP/1.0" 200 OK
 INFO:     logging in using static token
 ERROR:    Unclosed client session
 client_session: <aiohttp.client.ClientSession object at 0x10cf64eb0>
 ERROR:    Unclosed client session
 client_session: <aiohttp.client.ClientSession object at 0x10cf645e0>
 ERROR:    Unclosed connector
 connections: ['[(<aiohttp.client_proto.ResponseHandler object at
 0x10cedb2e0>, 20427.378)]']
 connector: <aiohttp.connector.TCPConnector object at 0x10cf64580>
 INFO:     127.0.0.1:58150 - "GET / HTTP/1.0" 200 OK
 INFO:     logging in using static token
 ERROR:    Unclosed client session
 client_session: <aiohttp.client.ClientSession object at 0x10cf66b20>
 ERROR:    Unclosed connector
 connections: ['[(<aiohttp.client_proto.ResponseHandler object at
 0x10cf37ac0>, 20427.611)]']
 connector: <aiohttp.connector.TCPConnector object at 0x10cf66880>
 INFO:     127.0.0.1:58152 - "GET / HTTP/1.0" 200 OK
 }}}

 However, again I'm having a really hard time reproducing the SQL
 connection bug that I've been experiencing. The ticket you mentioned above
 would surely solve this issue I'm experiencing but I would rather find the
 root cause as I'm sure you would.

 In order to demonstrate the above connection errors I simply logged in and
 out of an async HTTP library for Discord, so that could be their own fault
 and not related to Django. What still seems to be related to Django is
 reuse of old DB connections with the MAX AGE set to 0.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31515#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.461687eb510422f1150bcc3adc5088fd%40djangoproject.com.

Reply via email to