Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

RAISERROR ('Message', 20, 1) WITH LOG causes SQLCMD to hang

オープン
#785 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
go, sql
領域
cli

調査の方向性

まず、sysadmin アカウントを使って go-sqlcmd で RAISERROR ('Message', 20, 1) WITH LOG コマンドを再現し、次にその動作を ODBC sqlcmd と比較して、microsoft/go-sqlcmd#76 の部分的な解決を確認します。go-sqlcmd が SQL Server 接続の終了をどのように検出するかを追跡します。コマンドがハングするのではなく、致命的なエラーを報告して終了すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

When you execute the following command using a sysadmin account, SQLCMD hangs:

RAISERROR ('Message', 20, 1) WITH LOG

Noted this was mentioned in https://github.com/microsoft/go-sqlcmd/issues/76
That issue was closed with only a partial resolution to the issue.

Problem is caused by SQL Server forcibly terminating the connection - go-sqlcmd doesn't realise this has happened so gets into an undefined state and never exits.

https://learn.microsoft.com/en-us/sql/t-sql/language-elements/raiserror-transact-sql?view=sql-server-ver17

"Severity levels from 20 through 25 are considered fatal. If a fatal severity level is encountered, the client connection is terminated after receiving the message, and the error is logged in the error and application logs."

Workaround for me is to set the third parameter of RAISERROR (state) to 127 rather than 1 - but I'd rather it worked the same as ODBC sqlcmd does!

主要言語
Go
スター
601
フォーク
91
PR マージ指標
30日以内にマージされた PR はありません

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/go-sqlcmd のほかの issue

microsoft/go-sqlcmd の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。