View Issue Details

IDProjectCategoryView StatusLast Update
0000316UAImplementation Bugpublic2008-02-27 06:25
ReporterBrent Bowers Assigned ToRandy Armstrong  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Summary0000316: Subscriptions stop updating when reusing session names
Description

The root cause is that the StandardServer.CloseSession[1] method is passing the Session Id to SessionManager.CloseSession[2], but it is expecting the Authentication Token (both are of type NodeId). The SessionManager.CloseSession method attempts to look up the session in the dictionary of sessions but it is not found because the wrong key is being used (the SessionManager.CreateSession[3] method initially adds the session to the dictionary using the Authentication Token as the key).

The result is that the session is never actually closed. If a session with the same name is created, it ends up reusing the same Session Id. If the new session establishes a subscription, problems occur. Specifically, after the original session expires (by default, after 18 minutes of inactivity, as detected by SessionManager.MonitorSessions[4]), subscriptions for the new session stop reporting updates.

[1] public void CloseSession(OperationContext context, NodeId sessionId, bool deleteSubscriptions)
C:\Program Files\OPC Foundation\UA SDK 1.00\Source\Common\Server\Server\StandardServer.IServerInternal.cs

[2] public virtual void CloseSession(NodeId authenticationToken)
C:\Program Files\OPC Foundation\UA SDK 1.00\Source\Common\Server\Session\SessionManager.cs

[3] public virtual Session CreateSession(…)
C:\Program Files\OPC Foundation\UA SDK 1.00\Source\Common\Server\Session\SessionManager.cs
[Not to be confused with 'protected virtual Session CreateSession(…)']

[4] private void MonitorSessions(object data)
C:\Program Files\OPC Foundation\UA SDK 1.00\Source\Common\Server\Session\SessionManager.cs

Additional Information

Version 1.0.200.0

Steps to reproduce:
1) Run the sample server.
2) Run the sample client and connect to the sample server with the default session name.
3) Subscribe to the Server.ServerStatus.CurrentTime variable.
4) Exit the sample client.
5) Wait 18 minutes or longer (by default the session times out after 18 minutes).
6) Rerun the sample client and connect to the sample server with the default session name.
7) Subscribe to the Server.ServerStatus.CurrentTime variable.
8) The subscription does not update or only updates a few times.
9) Exit the sample client. The following error is reported
Subscription has not been created.
Id: BadInvalidState
Description: Subscription has not been created.

Alternate:
5a) Wait less than 18 minutes.
8a) The subscription stops updating once the full 18 minutes has passed.

TagsNo tags attached.
Fix Due Date

Activities

Randy Armstrong

2008-02-27 06:25

administrator   ~0000604

The Session class used the BrowseName to find the SessionDiagnostics Object instead of the NodeId. Reusing SessionNames caused the wrong Node to be deleted when the Session was closed.

Issue History

Date Modified Username Field Change
2008-02-19 18:39 Brent Bowers New Issue
2008-02-27 06:25 Randy Armstrong Status new => resolved
2008-02-27 06:25 Randy Armstrong Resolution open => fixed
2008-02-27 06:25 Randy Armstrong Assigned To => Randy Armstrong
2008-02-27 06:25 Randy Armstrong Note Added: 0000604