sqlcmd does not handle/honor the command timeout (-t) flag properly on Linux
I maintainer di solito rispondono entro 1 giorno
@dlevy-msft-sql ci sta già lavorando.
Dal 31/1/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 595
- Fork
- 91
- Merge medio
- 9h 35m
- PR unite (30g)
- 1
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/go-sqlcmd
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Fix CVEs in Version v1.10.0Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
microsoft/go-sqlcmd#733 · 7 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
":Help" command not workingAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/go-sqlcmd
Issue simili
-
automation models
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
txn2/mcp-data-platform#1984 ·
I maintainer di solito rispondono entro 1 giorno
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
kind/docs prio/P2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
agent-substrate/substrate#1986 ·
I maintainer di solito rispondono entro 1 giorno