Repository navigation
Fix live reading examples returning data minutes behind live (ADO 91065) - #66
Merged
Merged
Conversation
The snippet loaded with SessionSummary.GetConnectionString(), which only returns the Server Listener connection string when the recorder registered a listener for the session. For a LiveNotInServer session it silently falls back to the database, whose copy trails the leading edge by the recorder's flush delay (MaximumTimeInMemoryBeforeFlushingInSeconds, 300 s by default), and whose EndTime is fixed at load. Reproduced locally: the first poll returned data 341 s behind EndTime, then EndTime never moved again. Require State == Live and a SqlRaceServer connection string, and fail with a pointer to docs/server-listener.md otherwise; this matches the API's own guidance that LiveNotInServer sessions should not be loaded. Drop the extra database load used only to validate the parameter, and print how far the latest sample is behind the session end. Correct the server-listener.md troubleshooting row, which told users to reload the session every poll and cited this snippet for it.
- load_session used SessionSummary.key; pythonnet is case-sensitive, so it raised AttributeError. Use .Key, raise when the session is not found, warn on LiveNotInServer, and stop shadowing the session_summary() helper. - The polling loop created its own PDA per parameter per poll, leaving the new pdas list unused. Reuse the pre-created PDAs. - samples.Data(i) is not callable from pythonnet; index the array instead. - Revert the kernelspec/language_info metadata to the repo's defaults.
GetConnectionString() falls back to the database for a session whose recorder has no Server Listener, where EndTime is fixed at load and data trails the leading edge by the flush delay, so the dashboard froze with no explanation. Refuse a configured LiveNotInServer session and skip it when scanning, pointing at docs/server-listener.md.
CreateParameterDataAccess can return None (composite sessions), so skip those parameters and drop them from monitor_params, keeping the plotted history columns aligned.
salman-mclarenapplied
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes ADO 91065:
snippets/csharp/live-data/poll-live-samples.csreturns data about 5 minutes behind the session end time. This PR also folds in #63, keeping its two commits by @salman-mclarenapplied, and fixes the issues found while testing it.Root cause
All the live-reading examples load a session with
SessionSummary.GetConnectionString(). That returns the Server Listener connection string (SqlRaceServer:...) only when the recorder registered a listener for the session. For aLiveNotInServersession it silently falls back to the database, and two things go wrong:MaximumTimeInMemoryBeforeFlushingInSeconds(default 300 s) has passed since their last write, and that is checked every 60 s. The session end time, by contrast, is written every 0.5 s.EndTimeis read once at load and never updates.The
SessionState.LiveNotInServerdocs already say such a session "should not be loaded until its state has changed to historic".Changes
poll-live-samples.cs: requireState == Liveand aSqlRaceServerconnection string, otherwise exit with a pointer todocs/server-listener.md. Drop the extra database load that only validated the parameter. Print how far the latest sample is behind the session end.docs/server-listener.md: the troubleshooting row told users to reload the session every poll and cited this snippet. It now names the real cause and fix.LiveNotInServersession and skip it when scanning, because otherwise the dashboard freezes with no explanation.load_sessionusedSessionSummary.key, but pythonnet is case-sensitive, so this raisesAttributeError. It now uses.Key, raises when the session isn't found, and warns onLiveNotInServer.samples.Data(i)→samples.Data[i]. .NET arrays aren't callable from pythonnet. This bug was already on master..venv (3.13.9)kernel metadata.Testing
Tested against a local SQL Server, with a recorder writing 100 Hz data stamped with wall-clock time. One recording had the Server Listener on (
Live), one had it off (LiveNotInServer). The client side used SQL Race built from current source.load_session(Python).key→AttributeErrorconfirmed;Livepath not run end-to-end from Python** Loading a source build of SQL Race into pythonnet without a
deps.jsonhit native SQL client loading problems, so the PythonLivepath through the listener wasn't exercised end-to-end. The ATLAS-installed SQL Race couldn't talk to the source-built recorder (session summary wire-format mismatch).dotnet testpasses (65/65) against MESL.SQLRace.API 2.1.26272.6; the solution builds with warnings as errors.Supersedes #63.