Files
romanett 36acf1bb79 [master378] Fix GDS client deadlock after a failed keep-alive (#4623)
## Proposed changes

Minimal backport of the `GlobalDiscoveryServerClient` keep-alive part of
#4158 to `master378`.

On a bad keep-alive, `Session_KeepAliveAsync` took `m_lock` and called
`Session.Dispose()` on the keep-alive worker. `Session.Dispose()` waits
for that worker to stop, so the client deadlocked while holding
`m_lock`, and every later call (for example `FindApplicationAsync`)
hung.

The handler now returns right away and runs the cleanup with `Task.Run`,
so the keep-alive worker can stop before the session is disposed. The
cleanup skips its work if the client was disposed in the meantime (it
handles `ObjectDisposedException` on the lock and checks `m_disposed`).

`BackgroundTaskScope` from #4158 is not on 1.5.378, so this uses a plain
`Task.Run`. No public API changes.

## Related Issues

- Fixes #4621

## Types of changes

- [x] Bugfix (non-breaking change which fixes an issue)

## Checklist

- [x] Existing GDS client tests pass locally (`Opc.Ua.Gds.Tests`
`ClientTest`, net10.0: 102/102)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 07:24:37 +02:00
..