Commit 0a453c3
Coerce sp_HumanEvents @seconds_sample = 0/NULL to 1 second
@seconds_sample drives the WAITFOR DELAY that paces the XE session. The
duration-math block only populates @waitfor when @seconds_sample > 0,
so passing 0 or NULL left @waitfor at its default of N'' and the
unconditional WAITFOR DELAY @waitfor later crashed with a syntax error.
Tried a RAISERROR/THROW validation first, but the proc body is wrapped
in a TRY/CATCH whose CATCH block tries to ALTER EVENT SESSION ... STOP
on a session that was never created when the failure happens before
session creation. That overrides the original message with a
"session does not exist" error and makes the true problem unguessable.
Coerce to 1 second instead: NULL silently, 0 with a warning pointing
the caller at a more useful value. The proc then completes its normal
create / start / 1-second wait / stop / drop flow and returns empty
result sets. Callers still get a running proc and a discoverable
warning instead of a cryptic crash.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ca2dbd8 commit 0a453c3
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
893 | 912 | | |
894 | 913 | | |
895 | 914 | | |
| |||
0 commit comments