sqlcmd does not handle/honor the command timeout (-t) flag properly on Linux
@dlevy-msft-sql がすでに取り組んでいます。
2026年1月31日 から。
評価
この issue はまだ評価されていません。
説明
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.
- 主要言語
- Go
- スター
- 601
- フォーク
- 91
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/go-sqlcmd のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
-
-r discards the "Msg N, Level N, State N" error header — errors on stderr lose message number and line info再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
microsoft/go-sqlcmd の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
prime-radiant-inc/evener#3873 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
pion/interceptor#479 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
yetone/magpie#1035 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
slavakurilyak/awesome-ai-agents#710 ·
メンテナーはふだん 1 日以内に返信
-
`renderLinkedIssues` overshoots its byte budget: unresolved and omitted lists are never boundedオープンagent-butler-finding agent-research-recommend bug ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
jordansmall/spindrift#4614 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信