Projects tigase _server server-core Issues #1326
Impossible to configure timeout for bosh session inactivity timer (#1326)
wojciech.kapcia@tigase.net opened 3 years ago

(From: https://github.com/tigase/tigase-server/issues/154)

Describe the bug

BoshSession has an inactivity timer task that will be started at the end of every connection. When this timer fires, the user's session will be closed. However, if the chat client sends another connection before this timer expires then the timer is cancelled and the users' session will continue to remain. The duration for this timer, according to BoshConnectionManager code, is default to 10 seconds, and should be configurable via the bosh/max-inactivity property key in config.tdsl config file. However, this configuration override is not possible and the inactivity timeout is always stuck at 10s.

The cause of the issue seems to be another property in BoshConnectionManager, max_pause, that happens to use the same config key as max_inactivity. When we set max-inactivity in config.tdsl file, only max_pause value is updated to the new config value, but not max_inactivity.

BoshConnectionManager.java

   @ConfigField(
        desc = "Maximal allowed time of inactivity",
        alias = "max-inactivity"
    )
    private long max_inactivity = 10L;
    @ConfigField(
        desc = "Maximal allowed pause time",
        alias = "max-inactivity"               // <-- seems to be the culprit
    )
    private long max_pause = 10L;

To Reproduce Steps to reproduce the behavior:

  1. Add the property to tigase config.tdsl file:
bosh {
     'max-inactivity' = 90L
}

Also enable "FINEST" logging level in tigase, by modifying logging section in config.tdsl like this:

logging {
    rootHandlers = [ 'java.util.logging.FileHandler' ]
    rootLevel = CONFIG
    'packet-debug-full' = false
    loggers = {
        'tigase.server' = {
            level = ALL
        }
        'tigase.conf' = {
            level = FINEST
        }
    }
    handlers {
        'java.util.logging.FileHandler' {
            level = FINEST
            append = true
            count = '15'
            limit = '2097152'
            pattern = '/var/log/tigase/tigase.log'
        }
    }
}

  1. Restart tigase
  2. Log in to tigase from a web-based XMPP client on a recent version of Chrome.
  3. Background the browser tab that runs the chat client for at least 5 minutes
  4. Revisit the tab
  5. Check tigase log

Impact BoshSession inactivity timer always uses 10s timeout regardless of config. This leads to the user's session getting closed prematurely when the browser stop sending requests due to timer throttling in the browser (see https://bugs.chromium.org/p/chromium/issues/detail?id=1186569 ). This causes the chat client to be disconnected.

Expected behavior BoshSession inactivity timer uses the timeout value set in max-inactivity config property in config.tdsl.

Details (please complete the following information):

  • Tigase version: 8.1.0
  • JVM flavour and version: OpenJDK 11.
  • Operating system/distribution/version: RHEL 7

Additional context

tigase log shows the inactivity timer starting and firing after 10 seconds (note that the 1st log line has a bug where the part "Setting inactivityTimer for 10..." wasn't printed correctly, which I patched myself while investigating this issue):

[2022-05-18 08:17:40:742] [FINEST ] [scheduler_pool-7-thread-2-bosh ] BoshSession.disconnected(): TIMER : 26e59a86-fd34-43e8-a49c-33c5789d6259 (Setting inactivityTimer for 10 on: 10.90.131.13_5285_10.90.131.13_42886)

[2022-05-18 08:17:50:742] [FINEST ] [scheduler_pool-7-thread-2-bosh ] BoshSession.task() : task called for 26e59a86-fd34-43e8-a49c-33c5789d6259, inactivityTimer = tigase.server.bosh.BoshTask@7d5a05eb, tt = tigase.server.bosh.BoshTask@7d5a05eb [2022-05-18 08:17:50:742] [FINEST ] [scheduler_pool-7-thread-2-bosh ] BoshSession.task() : TIMER : 26e59a86-fd34-43e8-a49c-33c5789d6259 (inactivityTimer fired) [2022-05-18 08:17:50:742] [FINEST ] [scheduler_pool-7-thread-2-bosh ] BoshSession.task() : REMOVE : 26e59a86-fd34-43e8-a49c-33c5789d6259 (Closing session, inactivity timeout expired)

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
Version
tigase-server-8.3.0
Spent time
15m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1326
Please wait...
Page is in error, reload to recover