Repository navigation
OF-3459: Measure the detach timeout from the moment a session detached - #3559
Conversation
A client session that uses Stream Management is kept for a while after its connection breaks, so that the client can resume its stream: for xmpp.session.detach.timeout, 10 minutes by default, which Openfire also announces to the client in the 'max' attribute of <enabled/>. The task that ends detached sessions measured that time from the last stanza that the session sent or received, not from the moment at which it was detached. A session that had been quiet for longer than its timeout before its connection broke was therefore ended at the first run of that task after it was detached, within about a minute with the default settings, before the client could resume it. A session now records the moment at which it is detached, and the timeout is measured from that moment, or from the last activity of the session when that is later. A session that is resumed and later detached again gets the full timeout from its second detach. A session that is registered as detached without being detached has no such moment, or only that of an earlier detach, and is measured from its last activity. A client whose connection broke after a quiet period therefore stays available to its contacts for up to the detach timeout, as a busy one already did. The last activity of a session, as shown in the admin console, keeps its meaning. Termination delegates, which decide for themselves when a detached session ends, are not affected.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
OF-3459: passed test at e901a72ff, against main at 5cae384d2
| Step | Result |
|---|---|
| Delivered tests | 8/8 pass |
| Mutation testing | 9/9 checks detected; every test fails under at least one mutation |
Regression run (full xmppserver suite) |
3010 run, 0 failures, 3 skipped (disabled in the codebase) |
Independent conditions (running server, against main at 5cae384) |
24/24 as expected; 10 differ from main, all intended |
Independent conditions:
- Quiet session, connection broken: resumable for the full detach timeout after the break, over STARTTLS, direct TLS, WebSocket and SASL2 inline resume; on
mainit was already gone within one cleanup run. Also with the default 10-minute timeout (quiet for 11 minutes, resumed 2 minutes after the break). - Still ends on time: a session resumed after the timeout fails, quiet or busy, and the account's other resources see it go offline at the timeout, not within seconds.
- Detached again after a resumption: measured from the second break.
- Unchanged: stanzas sent to a detached session do not extend it; a properly closed stream and an idle connection closed by the server are not kept;
maxmatches the timeout, and is absent when it is disabled.
Mutation testing:
never()checks: each of the four fails on its own when sessions are ended early.
Coverage: adequate as delivered. The change is logic inside the cleanup task, and the unit tests cover each branch of it: measured from the detach, from later activity, with no detach moment, and after a second detach. A test at a higher level would have to wait out a real detach timeout, which adds little over the unit tests.
A client session that uses Stream Management is kept for a while after its connection breaks, so that the client can resume its stream: for xmpp.session.detach.timeout, 10 minutes by default, which Openfire also announces to the client in the 'max' attribute of . The task that ends detached sessions measured that time from the last stanza that the session sent or received, not from the moment at which it was detached. A session that had been quiet for longer than its timeout before its connection broke was therefore ended at the first run of that task after it was detached, within about a minute with the default settings, before the client could resume it.
A session now records the moment at which it is detached, and the timeout is measured from that moment, or from the last activity of the session when that is later. A session that is resumed and later detached again gets the full timeout from its second detach. A session that is registered as detached without being detached has no such moment, or only that of an earlier detach, and is measured from its last activity.
A client whose connection broke after a quiet period therefore stays available to its contacts for up to the detach timeout, as a busy one already did. The last activity of a session, as shown in the admin console, keeps its meaning. Termination delegates, which decide for themselves when a detached session ends, are not affected.