Opened 7 years ago
Last modified 6 years ago
#3771 reopened defect
[PATCH] Display a nice error message when trying to register too many lobby accounts
Reported by: | vincent | Owned by: | |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Backlog |
Component: | Multiplayer lobby | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
We should display a nice error message when someone tries to register too many lobby accounts within a short period of time, as nobody knows about this limitation and wonders why the registration doesn't work.
At the moment it just displays "Unknown error"
refs #3047
Fixed by workaround.
Should be fixed properly, when gloox catches this error correctly (https://bugs.camaya.net/ticket/?id=267)
Attachments (3)
Change History (23)
comment:1 by , 7 years ago
Keywords: | registration error multi removed |
---|---|
Milestone: | Backlog |
Resolution: | → invalid |
Status: | new → closed |
comment:2 by , 7 years ago
Description: | modified (diff) |
---|---|
Milestone: | → Backlog |
Resolution: | invalid |
Status: | closed → reopened |
Summary: | Registration Unknown error → Display a nice error message when trying to register too many lobby accounts |
comment:3 by , 7 years ago
Description: | modified (diff) |
---|
comment:4 by , 7 years ago
Component: | Core engine → Multiplayer lobby |
---|---|
Keywords: | beta added |
comment:5 by , 7 years ago
Keywords: | review added |
---|---|
Milestone: | Backlog → Alpha 22 |
Summary: | Display a nice error message when trying to register too many lobby accounts → [PATCH] Display a nice error message when trying to register too many lobby accounts |
comment:6 by , 7 years ago
Keywords: | patch added |
---|
comment:7 by , 7 years ago
Shouldn't we modify the lobby bot to return normal error, instead of hack?
follow-up: 10 comment:8 by , 7 years ago
I already discussed this with scythetwirler: There is no way to catch this error without rewriting gloox. The first patch shouldn't be committed because it's an ugly hack. The second patch is meant for review/commit and just adds a hint to "Unknown Error".
follow-up: 13 comment:9 by , 7 years ago
- Did scythe say why we'd have to rewrite gloox? (Why) Is it impossible/infeasible to change the "one account per ip per hour" rule of the lobbybot from an insta-disconnect to a sending of the dc reason + disconnect?
- What if we decide to make that 2 or 24 hours?
- What if someone else wants to use the engine without the public mod? There are many hardcoded 0ad logic things in the engine, but adding more won't improve that. (
lobby.js
would have to be moved tomods/mod/
eventually)
- It's not necessarily the same person but everyone with the same IP, the usual case is that two people on the same router both want an account.
- Assuming this default case is always hit when someone can't establish a connection, so it would be true if the server is down or if someone is IP-banned, right?
- Would it be better to return an empty string and add the custom explanation to
lobby.js
?
comment:10 by , 7 years ago
Replying to Imarok:
I already discussed this with scythetwirler: There is no way to catch this error without rewriting gloox.
Rewriting or patching? If it's a small patch, we could do this or write to authors of gloox.
comment:11 by , 7 years ago
I discussed that with scythe and he said, it won't be worth the effort catching the error.
comment:12 by , 7 years ago
Keywords: | rfc added; review removed |
---|
- The word you try to use as a comparative in that sentence is actually an adverb
- s/Would it be/It is - at least as long as we describe a scenario in that string that is not true for every xmpp server, thus allowing future contributors and modders to change the string without having to recompile the entire thing and not add to the "public mod specific logic in cpp" problem.
- All of the translated strings (
StanzaErrorToString
,ConnectionErrorToString
) could be moved toprelobby.js
by adding a function that translates the (only in cpp well defined) enum to a string that can be easily parsed in JS, likeGetPresenceString
orGetRoleString
. Should likely not be done as it would make it less mod friendly (requiring the modded game to copy the english strings defined in JS to the mod and either lose the translations from transifex or having to include all public mod translations in the mod or copying manually cutting out the strings from the public mod translation files (*.po
)) and since those strings are true for all xmpp servers (as they derive from the protocol, not from our server policy)
- Hence
prelobby.js
:Engine.GetGUIObjectByName("feedback").caption = message.text || translate("..."))
I guess, potentially an \n or moving it tog_UnknownDisconnectReason
if too long
comment:13 by , 6 years ago
Replying to elexis:
- Assuming this default case is always hit when someone can't establish a connection, so it would be true if the server is down or if someone is IP-banned, right?
If 0ad cannot establish the connection to the server it just freezes, so this is no issue (I think there was a ticket with this issue) The default case is just hit, if the server responds with an unknown error.
comment:14 by , 6 years ago
About the specs: Server: The XMPP server is an instance of ejabberd. We observe that ejabberd implements the XEP-0077 specification (https://docs.ejabberd.im/admin/configuration/#modregister)
mod_register In-Band Registration (XEP-0077)
The registration limit is a configuration documented at https://docs.ejabberd.im/admin/configuration/:
This module reads also another option defined globally for the server: registration_timeout: Timeout. This option limits the frequency of registration from a given IP or username. So, a user that tries to register a new account from the same IP address or JID during this number of seconds after his previous registration will receive an error resource-constraint with the explanation: “Users are not allowed to register accounts so quickly”. The timeout is expressed in seconds, and it must be an integer. To disable this limitation, instead of an integer put a word like: infinity. Default value: 600 seconds.
Client:
Our XmppClient uses gloox
. We can verify that it's registration also implemented XEP-0077 and is documented at https://camaya.net/api/gloox/classgloox_1_1Registration.html
This class is an implementation of XEP-0077 (In-Band Registration).
As linked from xep-0077.html #errors, error codes are defined by XEP-0086 and also include the mentioned resource-constraint
type.
According to our BuildInstructions , we require gloox 1.0.9 or later.
Current gloox stable is 1.0.18: https://camaya.net/gloox/.
If we download the 1.0.9 source, http://camaya.net/download/gloox-1.0.9.tar.bz2, we can see that StanzaErrorResourceConstraint
is already supported.
gloox Registration::handleIqID
of registration.cpp
of the gloox code upstream ( https://camaya.net/api/gloox/registration_8cpp_source.html ) simply doesn't check for that error and ends up in the "default" case.
About the proper Solution: Updating to the latest stable wouldn't help, as that also doesn't provide the check we need.
If we could modify gloox, we could add one case catching that StanzaErrorResourceConstraint
and add a new case to the enum RegistrationResult
, we could gracefully handle the registration limit case.
Our current string for the case that is never triggered for registrations is:
DEBUG_CASE(StanzaErrorResourceConstraint, "The recipient is unable to process the message due to resource constraints");
Once we can catch that case, we can also catch the Text
property sent within the Stanza
and stop worrying about providing custom strings: Users are not allowed to register accounts so quickly
. Perhaps the type
property could be used, it is wait
in our case.
Also refs https://www.ietf.org/rfc/rfc3920.txt
by , 6 years ago
Attachment: | result.jpg added |
---|
as we can see the data is actually sent by the lobby bot
comment:15 by , 6 years ago
Also the message we are looking for is hardcoded in src/mod_register.erl
of ejabberd ( https://github.com/processone/ejabberd/blob/master/src/mod_register.erl#L356 ):
ErrText = <<"Users are not allowed to register accounts " "so quickly">>, {error, xmpp:err_resource_constraint(ErrText, Lang)}
So even if we had it, we couldn't display how long the users have to wait.
comment:16 by , 6 years ago
Keywords: | rfc removed |
---|
Review part of the discussion moved to https://code.wildfiregames.com/D87 See https://code.wildfiregames.com/D87#3591 for a tested gloox and 0 A.D. patch that solve the issue correctly.
Gloox patch proposed at https://bugs.camaya.net/ticket/?id=267
comment:18 by , 6 years ago
Description: | modified (diff) |
---|---|
Keywords: | beta removed |
Milestone: | Alpha 22 → Backlog |
Priority: | Must Have → Nice to Have |
comment:19 by , 6 years ago
People should be able to create two accounts before the timeout takes effect: #4509
That's likely because you tried to create two accounts in a short while.