On Sunday, December 29, 2019 at 1:17:24 AM UTC-6, Mike Bayer wrote:
>
>
> I can't run the test app however 15 seems like your connection pool is set 
> up at its default size of 5 connections + 10 overflow, all connections are 
> being checked out, and none are being returned.
>

Hm, is the issue with running the app possibly something I could help with? 
I agree the magic 15 figure seems to be related to connection pool 
exhaustion. The funny thing is that the app still hangs on the 15th 
connection even if pool_size+overflow are expanded > 15, but not if the 
pool_size+overflow < 15 (?!)
 

>
> while I strongly recommend against using eventlet with Python DBAPI 
> drivers or SQLAlchemy,  when using eventlet or gevent with SQLAlchemy you 
> need to ensure that a full monkeypatch of  "thereading" / "socket" and 
> everything is performed before anything else is imported.   SQLAlchemy's 
> pool makes use of a port of the Queue class which makes use of threading 
> mutexes all of which will wreck an eventlet application that did not 
> correctly monkeypatch these.
>
> I'm also not familiar with any driver for MSSQL that supports implicit or 
> explicit async.   SQLAlchemy only works with PyODBC or pymssql neither of 
> which have async support that I'm aware of, what driver are you using ?
>

The test app is careful to initiate eventlet monkey patching before any 
additional logic/imports (except for the `import os` required to check if 
an envvar is set. The problem persists even if the envvar comparison is 
taken out and eventlet monkeypatching becomes the absolute first action of 
the test app).

https://github.com/bpaterni/flask-app-simple-blocking-eventlet/blob/d279ef9b6210122ebd9c7bd17fc7e8f4346ca74d/app.py#L3

The driver I'm using to connect to SQL Server is the official ODBC driver 
from Microsoft (mssql+pyodbc):

https://docs.microsoft.com/en-us/sql/connect/odbc/microsoft-odbc-driver-for-sql-server?view=sql-server-ver15

Apparently it *does* (or should) support async, as it is mentioned several 
times in the RELEASE_NOTES shipped with the driver. I'm not sure if it's 
does so implicitly or explicitly though.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/37931757-664c-4d42-babe-e59a3e4fd177%40googlegroups.com.

Reply via email to