Skip to content
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

Server shutdown delay when LDS local registration is enabled but LDS not present #2422

Closed
1 of 5 tasks
vallen-ptc opened this issue Dec 11, 2023 · 1 comment · Fixed by #2589
Closed
1 of 5 tasks
Assignees
Labels
bug A bug was identified and should be fixed.

Comments

@vallen-ptc
Copy link

Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

When the m_maxRegistrationInterval property is set to a non-zero value the stack code attempts to register with a local discovery server on shutdown of the internal server (see StandardServer.cs, line 3082). The method call on this line is RegisterWithDiscoveryServer.

If an LDS is not running on the host when the server is shutdown the RegisterWithDiscoveryServer method will block for approximately 21 seconds before the server completes the shutdown.

Expected Behavior

If an LDS is not running on the host when the server is shutdown and the RegisterWithDiscoveryServer method is commented out the server completes the shutdown in approximately 4 seconds.

The RegisterWithDiscoveryServer method should not block the server from shutting down when there isn't an LDS running on the host.

Steps To Reproduce

  1. Set the m_maxRegistrationInterval property in the server config to a non-zero value
  2. Start the server
  3. Wait for 30 seconds or so and shutdown the server
  4. Notice that it takes a while, ~21 seconds in our case, for the server shutdown to complete

Environment

- OS: Windows 11
- Environment: N/A
- Runtime: .NET 6.0.10
- Nuget Version: 1.4.371.86
- Component: Opc.Ua.Server.StandardServer
- Server: StandardServer
- Client: N/A

Anything else?

Technical Notes:

  1. RegisterWithDiscoveryServer attempts to register twice, first with a RegisterServer2 request and if that fails it attempts a RegisterServer request or vice versa depending on the value of m_useRegisterServer2 prior to entering the RegisterWithDiscoveryServer method.
  2. The registration failure is happening with the call to endpoint.UpdateFromServer(); on line ~2285 in StandardServer.cs
  3. The call to UpdateFromServer eventually calls client.GetEndpoints(null); on line 1059 in ConfiguredEndpoints.cs
  4. The call to GetEndpoints eventually calls UaSCUaBinarytransportChannel.BeginSendRequest which calls channel.BeginSendRequest (see line 365 in UaSCUaBinarytransportChannel.cs) with request = Opc.Ua.GetEndpointsRequest and m_operationTimeout = 600000.
@EthanChangAED
Copy link

@vallen-ptc, thank you for reporting this. It seems you have done some investigation already. If you already have an idea of fixing this, feel free to submit a PR. We are open to contributions from the users.

@EthanChangAED EthanChangAED linked a pull request Jan 8, 2024 that will close this issue
13 tasks
@mregen mregen removed a link to a pull request Jan 18, 2024
13 tasks
@romanett romanett self-assigned this Apr 11, 2024
@romanett romanett added bug A bug was identified and should be fixed. and removed needs investigation labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug was identified and should be fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants