-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix SourceTimestamp not updating on variable reads in BaseVariableState #3451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
Co-authored-by: romanett <[email protected]>
Co-authored-by: romanett <[email protected]>
set loglevel in session publish when no subscriptions ignore more keepalive errors in Client Fixture
|
@copilot please investigate why for arrays the timestamp is still set to server startup time instead of current time. even with the current fix. |
Co-authored-by: romanett <[email protected]>
Fixed in commit df0e8df. The issue was in BaseVariableState.ReadValueAttribute which only set the timestamp once when it was DateTime.MinValue, then never updated it on subsequent reads. Changed to always update timestamp on every read. Both scalar and array variables now correctly update timestamps (verified with new array test). |
Proposed changes
All variables (scalars, arrays, and other types) had SourceTimestamp frozen at the first read time instead of updating on each read. This was caused by BaseVariableState.ReadValueAttribute only setting the timestamp once when it was
DateTime.MinValue, then never updating it again on subsequent reads. This caused CTT test failures in Attribute Services / Attribute Read / Test Case 006.js.Fix: Modified BaseVariableState.ReadValueAttribute to always update the timestamp to
DateTime.UtcNowon every read operation.Root Cause
The issue was in
Stack/Opc.Ua.Types/State/BaseVariableState.cswhere the timestamp was only set conditionally:After the first read,
m_timestampwould have a value, so this check would never be true again, causing the timestamp to be frozen.Changes
ReadValueAttributeto always update timestamp on readReferenceNodeManagerVariablesUpdateTimestampOnReadAsync- verifies scalar variablesReferenceNodeManagerArrayVariablesUpdateTimestampOnReadAsync- verifies array variablesSolution
This ensures all variables system-wide (not just ReferenceNodeManager) properly update their SourceTimestamp on each read operation.
Types of changes
Checklist
Further comments
Test output shows timestamps correctly updating for both scalars and arrays:
10:26:54to10:26:5510:26:24to10:26:25All existing server tests pass (169 passed, 5 skipped).
The fix is implemented at the BaseVariableState level, ensuring all variables throughout the entire system (not just ReferenceNodeManager) benefit from proper timestamp updates on read operations.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.