Projects tigase _server server-core Issues #1273
Add option to limit number of concurrently connected resources (#1273)
Closed
wojciech.kapcia@tigase.net opened 3 years ago

(outcome of #systems-98).

Under normal circumstances users shouldn't need more than, let's say, 10 concurrent connections.

Andrzej Wójcik (Tigase) commented 3 years ago

@wojtek Looking at SM code, I wonder if we should not remove or decrease 30 in this line https://github.com/tigase/tigase-server/blob/daf6d51dda9e3f9ee2e00dceb8cc4f375c60e8be/src/main/java/tigase/server/xmppclient/StreamManagementIOProcessor.java#L648 as it forces check for timeout on outgoing message queue only if message is greater than 30. This could cause big (up to 30 packets) queues which should timeout already on next outgoing stanza.

What do you think?

Andrzej Wójcik (Tigase) commented 3 years ago

I've implemented this feature in issue #1273 branch in tigase-server and tigase-acs. Please review.

wojciech.kapcia@tigase.net commented 3 years ago

Relevant PR:

Looking at SM code, I wonder if we should not remove or decrease 30 in this line

I think we could try removing it - for a lot of "busy" users with many connections but not so many packets this could lead to lots of stale queues...

Andrzej Wójcik (Tigase) commented 3 years ago

Changes were applied.

wojciech.kapcia@tigase.net commented 3 years ago

Merged. tigase.im configured:

'sess-man' {
    'user-connections-limit' = 5
}
wojciech.kapcia@tigase.net commented 3 years ago
wojciech.kapcia@tigase.net commented 3 years ago

Issue fixed

wojciech.kapcia@tigase.net commented 3 years ago
[2021-09-01 18:33:48:435] [SEVERE  ] [urn:ietf:params:xml:ns:xmpp-bind-proc-0 ] WorkerThread.run(): tigase.server.xmppsession.SessionManager$ProcessorWorkerThread,(urn:ietf:params:xml:ns:xmpp-bind-proc-0) Exception during packet processing: Packet=from=c2s@ip-172-31-0-99.us-west-2.compute.internal/172.19.0.2_5222_46.32.66.157_57850, to=sess-man@ip-172-31-0-99.us-west-2.compute.internal, serverAuthorisedStanzaFrom=Optional[...@sure.im], DATA=<iq type="set" id="D94D114D-D211-4A39-9DB4-3657A42C8C12" xmlns="jabber:client" from="...@sure.im"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>iPhone ...</resource></bind></iq>, SIZE=204, XMLNS=jabber:client, PRIORITY=NORMAL, PERMISSION=AUTH, TYPE=set, STABLE_ID=2459fb31-766c-4ff6-bd71-e8339918c822, connection=XMPPResourceConnection=[user_jid=...@sure.im/iPhone ..., packets=3, connectioId=c2s@ip-172-31-0-99.us-west-2.compute.internal/172.19.0.2_5222_46.32.66.157_57850, domain=sure.im, authState=AUTHORIZED, isAnon=false, isTmp=false, parentSession hash=1726458013, parentSession liveTime=805]
java.lang.NullPointerException
	at tigase.server.cluster.strategy.OnlineUsersCachingStrategy.getConnectionRecordsByCreationTime(SourceFile:326)
	at tigase.cluster.SessionManagerClustered.checkSingleUserConnectionsLimit(SessionManagerClustered.java:191)
	at tigase.server.xmppsession.SessionManager.handleResourceBind(SessionManager.java:407)
	at tigase.cluster.SessionManagerClustered.handleResourceBind(SessionManagerClustered.java:180)
	at tigase.xmpp.XMPPResourceConnection.setResource(XMPPResourceConnection.java:532)
	at tigase.xmpp.impl.BindResource.process(BindResource.java:207)
	at tigase.server.xmppsession.SessionManager$ProcessorWorkerThread.process(SessionManager.java:2685)
	at tigase.util.processing.WorkerThread.run(WorkerThread.java:67)
wojciech.kapcia@tigase.net commented 3 years ago

@andrzej.wojcik as per our discussion I adjusted the check of the package age: https://github.com/tigase/tigase-server/commit/3f242016e14c1edfa97b55142987ebffd603c5fb -- should be OK I think.

issue 1 of 1
Type
Task
Priority
Normal
Assignee
Version
tigase-server-8.2.0
Spent time
5h 45m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1273
Please wait...
Page is in error, reload to recover