Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-10-01 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Florian Apolloner):

 Ok, I'd recommend enabling pool logging
 (https://www.psycopg.org/psycopg3/docs/advanced/pool.html#pool-operations-
 logging) and see where it goes south (also check the stats
 https://www.psycopg.org/psycopg3/docs/advanced/pool.html#pool-stats).
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019249718458-3e8d7535-0369-4285-9e12-62d86e8a8736-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-10-01 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by dseb):

 Replying to [comment:43 Florian Apolloner]:
 > This make sense, a small timeout value increases the chance to see this
 error if you are already running out of connections.

 My mistake, I meant to say "large timeout value". My containers each
 answer ~2 requests per second, average response time is about 400ms. It
 shouldn't take many connections to service this workload (even one
 connection should work, I think), and yet, with pool timeouts set to 30s
 and the pool max size set to 16, I'm seeing many such errors. Which is why
 it seems to me that the new pooling support hasn't solved this particular
 problem.
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019248545c86-f07f326e-9ba6-4e42-90c2-e228ec1caf80-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-09-30 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Florian Apolloner):

 > Even with a very high max connection count and a small timeout value,
 I'm seeing occasional `OperationalError: couldn't get a connection after X
 sec` errors.

 This make sense, a small timeout value increases the chance to see this
 error if you are already running out of connections. Whether there really
 is a leak or not is impossible to tell without having more information
 about your codebase and settings.
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107019244c36477-4615e4e3-ba1d-4e65-8334-13f8cf812a3d-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-09-30 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by dseb):

 Replying to [comment:38 johnthagen]:
 > For Postgres users, will the new Django 5.1 postgres connection pools
 mitigate this issue? Should ASGI users use this rather than persistent
 connections?
 >
 > - https://docs.djangoproject.com/en/5.1/releases/5.1/#postgresql-
 connection-pools

 It seems that the answer is no, connection pools do not yet mitigate this
 issue. In my testing, enabling connection pooling in an ASGI context
 causes connection leaks. Even with a very high max connection count and a
 small timeout value, I'm seeing occasional `OperationalError: couldn't get
 a connection after X sec` errors.
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070192445d4b66-b095dc58-ab61-4766-83e2-81b8ad856384-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-08-28 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Natalia <124304+nessita@…>):

 In [changeset:"26c06671d9f9ff679be5e290b0752a45e582ce0c" 26c0667]:
 {{{#!CommitTicketReference repository=""
 revision="26c06671d9f9ff679be5e290b0752a45e582ce0c"
 [5.1.x] Fixed #35688 -- Restored timezone and role setters to be
 PostgreSQL DatabaseWrapper methods.

 Following the addition of PostgreSQL connection pool support in
 Refs #33497, the methods for configuring the database role and timezone
 were moved to module-level functions. This change prevented subclasses
 of DatabaseWrapper from overriding these methods as needed, for example,
 when creating wrappers for other PostgreSQL-based backends.

 Thank you Christian Hardenberg for the report and to
 Florian Apolloner and Natalia Bidart for the review.

 Regression in fad334e1a9b54ea1acb8cce02a25934c5acfe99f.

 Co-authored-by: Natalia <124304+ness...@users.noreply.github.com>

 Backport of 7380ac57340653854bc2cfe0ed80298cdac6061d from main.
 }}}
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701919b191a9a-5acb4745-e2e4-4af0-a2ec-1da6a8cecf53-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-08-28 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by nessita <124304+nessita@…>):

 In [changeset:"7380ac57340653854bc2cfe0ed80298cdac6061d" 7380ac5]:
 {{{#!CommitTicketReference repository=""
 revision="7380ac57340653854bc2cfe0ed80298cdac6061d"
 Fixed #35688 -- Restored timezone and role setters to be PostgreSQL
 DatabaseWrapper methods.

 Following the addition of PostgreSQL connection pool support in
 Refs #33497, the methods for configuring the database role and timezone
 were moved to module-level functions. This change prevented subclasses
 of DatabaseWrapper from overriding these methods as needed, for example,
 when creating wrappers for other PostgreSQL-based backends.

 Thank you Christian Hardenberg for the report and to
 Florian Apolloner and Natalia Bidart for the review.

 Regression in fad334e1a9b54ea1acb8cce02a25934c5acfe99f.

 Co-authored-by: Natalia <124304+ness...@users.noreply.github.com>
 }}}
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701919b17c237-c53439bb-bd77-4f0c-84f5-0f57e3923300-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-07-25 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Yiwei Gao):

 * cc: Yiwei Gao (added)

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070190eadde48c-8838d576-0053-455e-a078-ef7438ee86f2-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-07-11 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by johnthagen):

 For Postgres users, will the new Django 5.1 postgres connection pools
 mitigate this issue? Should ASGI users use this rather than persistent
 connections?

 - https://docs.djangoproject.com/en/5.1/releases/5.1/#postgresql-
 connection-pools
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070190a1b6ffba-08e20c08-ade0-44bc-9e09-046b15839390-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-04-18 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Suraj Shaw):

 * cc: Suraj Shaw (added)

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ef13bac8c-a66e2e0d-86c0-4829-9f40-ea7e5abfe2db-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-04-18 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Suraj Shaw):

 I have created a  pull request for database connection pool support in
 oracle : https://github.com/django/django/pull/17834
 It would be great if people experiencing the same problem could test this
 with oracle backend (this would probably help in getting it merged).
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ef13a7dfe-e6d22ae4-4adc-45a5-a3e6-9fecf56b2ebc-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-03-23 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * owner:  Sarah Boyce => (none)
 * status:  assigned => new

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e6cdb4f25-12ee5f57-39cc-4b53-a067-15df6c8f7079-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-03-02 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  Sarah
 |  Boyce
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * has_patch:  1 => 0
 * stage:  Ready for checkin => Accepted

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018dffa589bd-3c6176f2-b408-43ab-9e5e-60df36ec9a3c-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-03-02 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  Sarah
 |  Boyce
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Ready for
  async  |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Mariusz Felisiak ):

 In [changeset:"fad334e1a9b54ea1acb8cce02a25934c5acfe99f" fad334e]:
 {{{#!CommitTicketReference repository=""
 revision="fad334e1a9b54ea1acb8cce02a25934c5acfe99f"
 Refs #33497 -- Added connection pool support for PostgreSQL.

 Co-authored-by: Florian Apolloner 
 Co-authored-by: Ran Benita 
 }}}
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018dffa43d31-72363bd8-2cce-4f66-864e-626322e380fb-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-03-01 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  Sarah
 |  Boyce
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Ready for
  async  |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018df9097ef6-41454d5c-d558-4158-8c41-903ccea23327-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-02-19 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  Sarah
 |  Boyce
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by johnthagen):

 As a user of Django, I was looking through the steps needed to optimize my
 application, and came across

 - https://docs.djangoproject.com/en/5.0/topics/performance/#other-
 database-related-tips

 It was then after a long amount of research/reading that I came across
 this ticket. We are planning to soon upgrade our application to use
 uvicorn workers and run under ASGI so that we can serve web sockets
 alongside our HTTP API, and thus we now have pause to perform this
 standard optimization due to this issue.

 Questions:

 1. Does this issue affect all ASGI Django HTTP endpoints, even synchronous
 ones (e.g. no `async`, no `database_sync_to_async()`, etc.)?
 2. Should the docs be updated to add a warning about the fact that
 persistent connections are not currently fully compatible with ASGI? I'd
 be happy to open a PR as it would have saved me personally a lot of time
 if I had discovered this earlier in my research process.
-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018dc16b680d-66c0c805-05ca-4030-b72e-c78eb4512869-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-01-17 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  Sarah
 |  Boyce
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sarah Boyce):

 There is already a ticket (and now a PR) to support database connection
 pools in Oracle: #7732

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d1b10f2c0-72774037-f448-4716-ab6f-1d0da422245b-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-01-10 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  Sarah
 |  Boyce
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Dmytro Litvinov):

 * cc: Dmytro Litvinov (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018cf2b08337-4636b835-40f7-4242-8718-7b75fcaaefed-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2024-01-01 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  Sarah
 |  Boyce
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce):

 * needs_better_patch:  1 => 0


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018cc6a29468-1dd7e382-543a-4c5c-8fbe-33237b290dcc-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-12-19 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  Sarah
 |  Boyce
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * owner:  nobody => Sarah Boyce
 * needs_better_patch:  0 => 1
 * status:  new => assigned


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c814fd6c7-ce0a9d01-a764-4e2e-aadd-1fea2c37b16f-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-12-12 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Florian Apolloner):

 Well, I guess the main question is if we want to create our own pool
 implementation or reuse what the database adapters provide and assume that
 they can do it better for their database than we can do it generically :D

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c5f0028fc-83299149-6fb4-4ac8-8f7d-27837b867f06-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-12-12 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce):

 * has_patch:  0 => 1


Comment:

 Will need to add solutions for other backends but don't see a reason why
 we can't do this incrementally - the current patch is for postgreSQL:
 https://github.com/django/django/pull/17594

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c5efc7925-2158faab-dcb5-441f-aedb-74df02483d26-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-12-12 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Sarah Boyce):

 * cc: Sarah Boyce (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c5dba07ab-9b88157c-90e9-4dc8-a038-b3924c0fddde-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-12-11 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sarah Boyce):

 Replying to [comment:22 Andreas Pelme]:

 > However, that would only work for postgres. What is the situation with
 mysql/oracle? Does mysqlclient come with a pool like psycopg?

 Oracle: https://python-
 
oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#connpooling
 mysqlclient doesn't appear to support this out of the box. Looks like
 mysql-connector-python would have support though:
 https://dev.mysql.com/doc/connector-python/en/connector-python-connection-
 pooling.html 🤔

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c5ae43088-1b3347fa-c6bd-45e7-90cf-a2d5f2431aa3-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-09-11 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Andreas Pelme):

 We have been using `CONN_MAX_AGE=300` since it was introduced in Django
 1.6 and rely in it for not having to reconnect to the database in each
 http request. This change really caught us off guard. We upgraded from
 django 3.2 to 4.0 and our site went completely down in a matter of seconds
 when all database connections was instantly depleted.

 Giving each http request its own async context makes a lot of sense and is
 a good change in itself IMO. But I would argue that this change is not
 backward compatible. `CONN_MAX_AGE` does still "technically" work but it
 does clearly not behave as it has been doing for the last 10 years.

 Specifying `CONN_MAX_AGE` is recommended in a lot of places, including
 Django's own docs:
 - https://docs.djangoproject.com/en/4.2/ref/databases/#persistent-
 database-connections
 - https://devcenter.heroku.com/articles/python-concurrency-and-database-
 connections

 At the very least, I think this needs to be clearly called out in the
 release notes and docs on "Persistent connections". I think we need to
 deprecate/remove `CONN_MAX_AGE`. Or is there even a reason to keep it
 around?

 I am very much in favor of getting basic db connection pooling into
 django. We will try to give https://github.com/django/django/pull/16881 a
 spin and put it in production and report back. Would love to have
 something like that available out of the box in Django! We use Postgres
 and would be happy with having such a pool which would replace
 CONN_MAX_AGE for our use case.

 However, that would only work for postgres. What is the situation with
 mysql/oracle? Does mysqlclient come with a pool like psycopg?

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018a8429d2d9-c6712351-6ad3-4a0c-9b38-7d05ca514ee2-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-06-09 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by lappu):

 * cc: lappu (added)


Comment:

 We just ran into this while upgrading from 3.2 to 4.2. During a QA round
 our staging environment '''MySQL''' server running on AWS RDS t3.micro
 instance exceeded its max connections (70? or so, while normally the
 connections stay below 10).

 I git bisected the culprit to be
 
https://github.com/django/django/commit/36fa071d6ebd18a61c4d7f1b5c9d17106134bd44,
 which is what Carlton Gibson suspected.

 We are also running uvicorn.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701889f5da40c-858b83b6-ea50-4bcc-be28-ea69d0fadf62-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-05-20 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Florian Apolloner):

 I have created a draft pull request for database connection pool support
 in postgresql: https://github.com/django/django/pull/16881

 It would be great if people experiencing the problems noted here could
 test this (this would probably help in getting it merged).

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701883a52008c-a1e8fc6a-485d-47d8-b1a3-64fe50545f92-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-05-08 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Marty Cochrane):

 * cc: Marty Cochrane (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070187fece0959-714e7be1-5cd1-44bf-adbb-fb67ca86eceb-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-04-03 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Rafał Pitoń):

 * cc: Rafał Pitoń (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070187495d3e83-e0e2272a-63c5-4a00-a09c-c9e3ee29263a-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-01-04 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  (none)
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by rajdesai24):

 * owner:  rajdesai24 => (none)
 * status:  assigned => new


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701857fc5f649-3b04d1d9-ec39-4405-9f78-32ed7665afe7-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-01-04 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:
 |  rajdesai24
 Type:  New feature  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by rajdesai24):

 * owner:  nobody => rajdesai24
 * status:  new => assigned


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701857d856ccd-2ed6fec3-a61d-402f-852a-01edefb37540-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2023-01-02 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Marco Glauser):

 * cc: Marco Glauser (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018571a113a0-35a3c55f-a2cb-4aec-9ba8-479ace93a372-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-11-27 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by joeli):

 * cc: joeli (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070184bd202b87-ae742195-af3f-42c4-8d06-dbd3a09a636c-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-11-27 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by joeli):

 Replying to [comment:12 Patryk Zawadzki]:
 > This is marked as a "new feature," but it's an undocumented breaking
 change between 3.2 and 4.0. Connections that were previously reused and
 terminated are now just left to linger.
 >
 > The {{{request_finished}}} signal does not terminate them as they are
 not idle for longer than {{{MAX_CONN_AGE}}}.
 >
 > The {{{request_started}}} signal does not terminate them as it never
 sees those connections due to the connection state being
 {{{asgiref.local}}} and discarded after every request.
 >
 > Allowing parallel execution of requests is a great change, but I feel
 Django should outright refuse to start if {{{MAX_CONN_AGE}}} is combined
 with ASGI.

 I agree. I would even go as far as calling this a regression, not just an
 undocumented breaking change. No matter the reasons behind it or the
 technical superiority of the new solution, fact of the matter stands that
 in 3.2 ASGI mode our code worked fine and reused connections. In 4.x it is
 broken unless using {{{MAX_CONN_AGE = 0}}}, which disables a feature in
 Django that used to work.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070184bd1feafd-5d9c26ab-a535-4737-9d4e-e7cfd0e43906-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-11-24 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Alex):

 * cc: Alex (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070184a8eaa05f-a7c91085-0875-4bdc-b87d-9808af8549bd-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-11-13 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI, Database,  | Triage Stage:  Accepted
  async  |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * keywords:  ASGI; Database => ASGI, Database, async


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070184700fecaa-66b38001-9ff4-413c-be3d-f7d9f70c196a-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-09-05 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI; Database   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Patryk Zawadzki):

 This is marked as a "new feature," but it's an undocumented breaking
 change between 3.2 and 4.0. Connections that were previously reused and
 terminated are now just left to linger.

 The {{{request_finished}}} signal does not terminate them as they are not
 idle for longer than {{{MAX_CONN_AGE}}}.

 The {{{request_started}}} signal does not terminate them as it never sees
 those connections due to the connection state being {{{asgiref.local}}}
 and discarded after every request.

 Allowing parallel execution of requests is a great change, but I feel
 Django should outright refuse to start if {{{MAX_CONN_AGE}}} is combined
 with ASGI.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701830da5b139-af5f68d4-5a2b-41d3-9f2c-fe6718f1790e-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-09-05 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI; Database   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mikail):

 * cc: Mikail (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701830d9e1293-9c5e46ce-729b-4920-9bb6-24b30a64d88a-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-09-05 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI; Database   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Patryk Zawadzki):

 * cc: Patryk Zawadzki (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701830d49bbd5-17215431-43df-4b1f-8f81-a44ced5ae134-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-04-07 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI; Database   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Anders Kaseorg):

 * cc: Anders Kaseorg (added)


Comment:

 Possibly related: #33625 (for memcached connections).

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701800774d8f7-4bef4a83-b544-4e1c-a2ba-e2ba9aae7c65-00%40eu-central-1.amazonses.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-02-13 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI; Database   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Florian Apolloner):

 Thinking more about this I do not think the problem is new. We have the
 same problem when persistent connections are used and a new thread is
 generated per request (for instance in runserver.py). Usually (ie with
 gunicorn etc) one has a rather "stable" pool of processes or requests; as
 soon as you switch to new threads per connection this will break. In ASGI
 this behavior is probably more pronounced since by definition every
 request is in it's own async task context which then propagates down to
 the db backend as new connection per request (which in turn will also
 never reuse connections because the "thread" ids change).

 All in all I think we are finally at the point where we need a connection
 pool in Django. I'd strongly recommend to use something like
 https://github.com/psycopg/psycopg/tree/master/psycopg_pool/psycopg_pool
 but abstracted to work for all databases in Django.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.91053f1b76664405463a4b3f47a725a0%40djangoproject.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-02-10 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI; Database   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * type:  Bug => New feature
 * stage:  Unreviewed => Accepted


Comment:

 OK, thanks Stenkar.

 I'm going to accept this as a New Feature. It's a change in behaviour from
 3.2, but it's precisely in allowing multiple executors for
 `sync_to_async()` that it comes up. (In 3.2 it's essentially single-
 threaded, with only a single connection actually being used.) We need to
 improve the story here, but it's not a bug in #32889 that we don't have
 async compatible persistent DB connections yet. (I hope that makes sense.)

 A note to the docs about this limitation may be worthwhile.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.5dbd61ff005ebceab37763126d0e26b7%40djangoproject.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-02-08 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI; Database   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Stenkar):

 * status:  closed => new
 * resolution:  needsinfo =>


Comment:

 Thank you for the comments.

 I created a project where it's possible to spin up a minimal project with
 docker-compose.

 https://github.com/KStenK/django-ticket-33497

 I'm not sure that I can find where or what goes wrong in more detail, but
 I'll give it a try.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.f920bb7b32b8045a6c3e3cd68fba0cec%40djangoproject.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-02-08 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:  ASGI; Database   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Florian Apolloner):

 I think https://github.com/django/asgiref/pull/306#issuecomment-991959863
 might play into this as well. By using a single thread per connection,
 persistent connections will never get clean up.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.24676558c1e574da50e9b294d429a932%40djangoproject.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-02-08 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:  ASGI; Database   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * cc: Florian Apolloner, Andrew Godwin (added)


Comment:

 Hi Stenkar.

 Would you be able to put together a minimal test-project here, so that
 folks can reproduce quickly.

 This **may** be due to Django 4.0 having per-request contexts for the
 thread sensitivity of `sync_to_async()` — See #32889.
 If so, that's kind-of a good thing, in that too many open resources is
 what you'd expect in async code, and up to now, we've not been hitting
 that, as we've essentially been running serially.

 Immediate thought for a mitigation would be to use a connection pool.

 Equally, can we limit the number of threads in play using
 
[https://github.com/django/asgiref/blob/02fecb6046bb5ec0dbbad00ffcd2043e893fcea5/asgiref/sync.py#L303-L304
 asgiref's `AGSI_THREADS` environment variable]? (But see
 [https://github.com/django/daphne/issues/319#issuecomment-991962381 the
 discussion on the related Daphne issue about whether that's the right
 place for that at all].)

 This is likely a topic we'll need to deal with (eventually) in Django:
 once you start getting async working, you soon hit resource limits, and
 handling that with structures for sequencing and maximum parallelism is
 one of those hard-batteries™ that we maybe should provide. 🤔

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.c7c39b71208515a9d8654343ae156a48%40djangoproject.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0

2022-02-07 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  needsinfo
 Keywords:  ASGI; Database   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * cc: Carlton Gibson (added)
 * status:  new => closed
 * resolution:   => needsinfo


Comment:

 Thanks for the report. ​Django has a
 
[https://github.com/django/django/blob/f0480ddd2d3cb04b784cf7ea697f792b45c689cc/django/db/__init__.py#L34-L42
 routine] to clean up old connections that is tied into the request-
 response life-cycle, so idle connections should be closed. However, I
 don't think you've explained the issue in enough detail to confirm a bug
 in Django. This can be an issue in `psycopg2`, `uvicorn`, or in custom
 middlewares (see #31905) it's hard to say without a reproduce.

 Please reopen the ticket if you can debug your issue and provide details
 about why and where Django is at fault, or if provide a sample project
 with reproducible scenario.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.78159b083a4f799a2f365b03c04595fb%40djangoproject.com.


Re: [Django] #33497: Database persistent connections do not work with ASGI in 4.0 (was: Database persistent connection do not work with ASGI in 4.0)

2022-02-06 Thread Django
#33497: Database persistent connections do not work with ASGI in 4.0
-+-
 Reporter:  Stenkar  |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ASGI; Database   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.4acfed6d737538d78e79396baa01de69%40djangoproject.com.