Connection keeps open transaction (open_transaction_count) after connection.commit - works as intended?
@sumitmsft đang làm issue này rồi.
Từ ngày 9/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Hello,
when using mssql-python we observed that it does not seem to close/commit all transactions.
For example with this script:
with mssql_python.connect(conn_string) as conn:
with conn.cursor() as cursor:
cursor.execute("SELECT * FROM People")
print("wait here with debugger")
Before the application exits we see open transactions with this:
SELECT
s.session_id,
s.login_time,
s.host_name,
s.program_name,
s.login_name,
s.last_request_end_time,
c.most_recent_sql_handle,
s.open_transaction_count,
r.*
FROM sys.dm_exec_sessions s
LEFT JOIN sys.dm_exec_requests r
ON r.session_id = s.session_id
LEFT JOIN sys.dm_exec_connections c
ON c.session_id = s.session_id
WHERE s.open_transaction_count > 0
Is this intended behavior? The opened transaction does not seem to block any resources.
When doing a manual commit cursor.execute("IF @@TRANCOUNT > 0 COMMIT TRANSACTION") the transactions are closed properly before the application exits.
- Ngôn ngữ chính
- Python
- Star
- 473
- Fork
- 60
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 36
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/mssql-python
-
bulkcopy PyCore login is closed by SQL Server 2019 while ODBC and Go clients succeed (1.14.0) Đang mởarea: bulk-copy bug triage done
microsoft/mssql-python#750 · 4 bình luận · 1 người được giao ·
-
announcement
microsoft/mssql-python#748 · 1 người được giao ·
-
area: connectivity-auth bug triage needed
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 62/100
microsoft/mssql-python#746 · 1 bình luận ·
-
area: data-types bug triage done
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
microsoft/mssql-python#745 · 1 bình luận ·
-
area: packaging-platform bug dependency: external triage done
microsoft/mssql-python#685 · 2 bình luận · 1 người được giao ·
Tất cả issue của microsoft/mssql-python
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
zostera/django-bootstrap4#894 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
use-agent-os/agent-os#3276 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#117848 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
zilliztech/memsearch#759 ·