sqlcmd does not handle/honor the command timeout (-t) flag properly on Linux
@dlevy-msft-sql đang làm issue này rồi.
Từ ngày 31/1/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
sqlcmd does not properly handle/honor the SQL Command Timeout (-t) flag properly on Linux. It works fine on Windows but the command always "hangs" for ~10 minutes before finally exiting when run on a Linux system .
Testing Setup
Test Table
USE [dba]
GO
CREATE TABLE [dbo].[DBScriptTable](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[placeName] [varchar](100) NULL,
PRIMARY KEY CLUSTERED ([id] ASC)
) ON [PRIMARY]
GO
Blocker DML
This script will create an open transaction against the above table with SERIALIZABLE transaction isolation level. Running it without completing the transaction will essentially block all operations on the table until the script is either rolled back or committed. That's why the ROLLBACK is commented out here.
-- This should be run from within SSMS so you can control the transaction
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE ;
BEGIN TRANSACTION
INSERT INTO DBscriptTable (placeName) VALUES ('Redmond, Washington') ;
--ROLLBACK TRANSACTION
Test DML
Simple select to use for our sqlcmd tests
-- Save as test.sql
SELECT * FROM DBScriptTable
GO
How to replicate this behavior
-
Create the test table in a database named
dba -
Run the Blocker DML with the
ROLLBACKcommented out from SSMS. This will block all operations on the table. Using something likesp_WhoIsActiveyou should be able to verify that we now have a sleeping session with an open transaction for this. -
Run
sqlcmdscript below in PowerShell on Windows 11. You will notice that this script will return immediately after the command timeout of 1 second
PS> get-date; sqlcmd -S "<redacted>" -U "<redacted>" -P "<redacted>" -i ./test.sql -d dba -t 1; get-date
Tuesday, August 12, 2025 10:20:26 AM
Timeout expired
Tuesday, August 12, 2025 10:20:27 AM
PS>
- Run the
sqlcmdscript below on a Linux system inbash. You will notice that the SQL "Timeout expired" message will appear after 1 second, butsqlcmddoes not return us to a bash prompt for 10 minutes. I'm not exactly sure what it's waiting on here and this is the unexpected behavior.
$ date; sqlcmd -S "<redacted>" -U "<redacted>" -P "<redacted>" -i ./test.sql -d dba -t 1; date
Tue Aug 12 10:19:56 EDT 2025
Timeout expired
Tue Aug 12 10:29:57 EDT 2025
$
- Make sure you uncomment and execute the
ROLLBACKin the SQL script to complete that transaction.
- Ngôn ngữ chính
- Go
- Star
- 601
- Fork
- 91
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có 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/go-sqlcmd
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Fix CVEs in Version v1.10.0Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
":Help" command not workingĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
-
-r discards the "Msg N, Level N, State N" error header — errors on stderr lose message number and line infoCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
Tất cả issue của microsoft/go-sqlcmd
Issue tương tự
-
`renderLinkedIssues` overshoots its byte budget: unresolved and omitted lists are never boundedĐang mởagent-butler-finding agent-research-recommend bug ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
jordansmall/spindrift#4614 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
weaviate/weaviate-go-client#485 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
litmuschaos/litmus#5641 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày