-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when the main app is shutdown, prisma rust is still keeping the connection open in the background #995
Comments
@vikyw89 I can't reproduce this with mysql v8, could you share a script to reproduce the issue? My scriptimport asyncio
from prisma import Prisma
async def check_mysql_connections():
prisma = Prisma()
await prisma.connect()
# Get total number of connections
total_conn = await prisma.query_raw("SHOW STATUS WHERE Variable_name = 'Threads_connected';")
print(f"Total connections: {total_conn[0]['Value']}")
# Get max allowed connections
max_conn = await prisma.query_raw("SHOW VARIABLES LIKE 'max_connections';")
print(f"Max connections allowed: {max_conn[0]['Value']}")
# Get detailed information about current connections
detailed = await prisma.query_raw("""
SELECT
ID,
USER,
HOST,
DB,
COMMAND,
TIME,
STATE,
INFO
FROM
INFORMATION_SCHEMA.PROCESSLIST
ORDER BY
TIME DESC
LIMIT 10;
""")
print('\nDetailed connection information (latest 10):')
for row in detailed:
print(row)
# Get connection counts by user and host
user_host_counts = await prisma.query_raw("""
SELECT
USER,
HOST,
COUNT(*) AS connection_count
FROM
INFORMATION_SCHEMA.PROCESSLIST
GROUP BY
USER, HOST
ORDER BY
connection_count DESC;
""")
print('\nConnection counts by user and host:')
for row in user_host_counts:
print(f"{row['USER']}@{row['HOST']}: {row['connection_count']}")
# Get connection counts by state
state_counts = await prisma.query_raw("""
SELECT
STATE,
COUNT(*) AS connection_count
FROM
INFORMATION_SCHEMA.PROCESSLIST
GROUP BY
STATE
ORDER BY
connection_count DESC;
""")
print('\nConnection counts by state:')
for row in state_counts:
state = row['STATE'] if row['STATE'] else 'NULL'
print(f"{state}: {row['connection_count']}")
asyncio.run(check_mysql_connections()) Running this script always outputs the same information for me, I'd expect it to be different if the connections weren't actually being closed. |
Screencast.from.2024-08-28.03-32-29.mp4 |
poetry run test_db.py script
poetry run start script
this is my DATABASE_URL
this is my prisma init script
I'm using fastapi server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug description
and .env changes won't get reflected in the client (example changing url param, connection_limit, etc) which I think is caused by the old prisma rust is still active and using the old .env
How to reproduce
There are 2 ways:
Environment & setup
The text was updated successfully, but these errors were encountered: