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

Add server-side session watchdog #1655

Merged
merged 7 commits into from
Jun 20, 2024

Conversation

chrisjbremner
Copy link
Contributor

As discussed here, to comply with section 5.6.2 of the spec, the server should close a session that is inactive within its session timeout:

Sessions are terminated by the Server automatically if the Client fails to issue a Service request on the Session within the timeout period negotiated by the Server in the CreateSession Service response. This protects the Server against Client failures and against situations where a failed underlying connection cannot be re-established. Clients shall be prepared to submit requests in a timely manner to prevent the Session from closing automatically.

I no longer think this will actually resolve anything in #116, but I think it's useful nonetheless if we want to comply with the spec.

@chrisjbremner chrisjbremner requested a review from oroulet June 11, 2024 23:51
@@ -59,13 +67,44 @@ async def get_endpoints(self, params=None, sockname=None):
def is_activated(self) -> bool:
return self.state == SessionState.Activated

def update_last_action_time(func):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand what you want to do, but I have bad experience with that kind of decorators. they make stack trace a mess and completlu breaks typing checks. if we want t omerge that we at least need typing and check things with mypy (which probbaly only does not complain because since you do not have typing on decorator so it disabled itself)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it is better to update some timestamp at lower level when we receive a request which is dispatched to thata internal session. IS that possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I moved it into the UA processor

@oroulet oroulet merged commit 6ff4c24 into FreeOpcUa:master Jun 20, 2024
5 checks passed
@chrisjbremner chrisjbremner deleted the connection_watchdog branch June 20, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants