Page MenuHomeFeedback Tracker

OnUserDisconnected reliability issues
Feedback, NormalPublic

Description

Occasionally, a player will be able to leave the server without OnUserDisconnected event ever firing.

Server info:
Build: Stable
Version: 2.12.150301

Details

Severity
Major
Resolution
Open
Reproducibility
Unable To Reproduce
Operating System
Windows 10 x64
Operating System Version
Windows Server 2019 10.0.17763
Category
Scripting
Steps To Reproduce

I was not able to reproduce this by myself in a controlled environment, but this bug is not uncommon in a live server environment.

Code is executed from a server mod.
init.sqf (preInit = 1)

addMissionEventHandler ["OnUserConnected", test_fnc_playerJoin];
addMissionEventHandler ["OnUserDisconnected", test_fnc_playerLeave];

playerJoin.sqf

params ["_networkId", "", ""];

private _user = getUserInfo _networkId;

_user params ["", "", "_playerUID", "", "_displayName", "", "", "", "", "", ""];

private _args = [_playerUID, _displayName];

["debug", format ["Player %1 (%2) joined", _playerUID, _networkId]] call test_fnc_log;

playerLeave.sqf

params ["_networkId", "", ""];

private _user = getUserInfo _networkId;

_user params ["", "", "_playerUID", "", "", "", "", "", "", "", ""];

["debug", format ["Player %1 (%2) left", _playerUID, _networkId]] call test_fnc_log;

log.sqf

params ["_level", "_log"];

_level = toUpper _level;

diag_log format ["TEST [%1] %2", _level, _log];
Additional Information

related lines from server rpt, there is no logs of this player disconnecting, but they rejoin with a new id

2023/05/15, 17:26:06 BEServer: registering a new player #674485372
2023/05/15, 17:26:07 "TEST [DEBUG] Player 76561198795646609 (674485372) joined"
...
2023/05/15, 18:59:39 BEServer: registering a new player #1992789972
2023/05/15, 18:59:42 "TEST [DEBUG] Player 76561198795646609 (1992789972) joined"

BattleMetrics logs this player in local time, but it can be seen that the minutes match up. There is no RPT log for this player leaving the server.

1:26 PM Ivan joined the server
2:59 PM Ivan left the server
2:59 PM Ivan joined the server

related lines from server.log

17:26:05 BattlEye Server: Player #102 Ivan (IP REDACTED) connected
17:26:07 BattlEye Server: Player #102 Ivan - BE GUID: 966dd42cdac98b2e405f452438d2a4cb
17:26:07 Player Ivan connected (id=76561198795646609).
17:26:07 BattlEye Server: Verified GUID (966dd42cdac98b2e405f452438d2a4cb) of player #102 Ivan
...
18:59:34 Player Ivan disconnected.
18:59:34 BattlEye Server: Player #102 Ivan disconnected
18:59:34 BattlEye Server: Player #102 Ivan disconnected
18:59:39 BattlEye Server: Player #220 Ivan (IP REDACTED) connected
18:59:42 BattlEye Server: Player #220 Ivan - BE GUID: 966dd42cdac98b2e405f452438d2a4cb
18:59:42 Player Ivan connected (id=76561198795646609).
18:59:42 BattlEye Server: Verified GUID (966dd42cdac98b2e405f452438d2a4cb) of player #220 Ivan

Event Timeline

BIS_fnc_KK set Ref Ticket to AIII-55688.May 21 2023, 1:39 PM

Revision: 150637
I will push this to profiling as well. Basically if you see message in server console then the EH should have fired as well

BIS_fnc_KK removed BIS_fnc_KK as the assignee of this task.May 21 2023, 1:43 PM
BIS_fnc_KK changed the task status from New to Feedback.
BIS_fnc_KK added a subscriber: BIS_fnc_KK.

Still occurring after latest prof build

Type: Public
Build: Stable
Version: 2.12.150657

server rpt

17:43:37 "TEST [DEBUG] Player 76561198998552502 (72187382) joined"

no further connection or disconnections from this steamid or network id

server.log

17:43:33 [VIMPEL]PAHTERA uses modified data file
17:43:35 BattlEye Server: Player #31 [VIMPEL]PAHTERA (IP REDACTED) connected
17:43:35 Player [VIMPEL]PAHTERA connecting.
17:43:37 BattlEye Server: Player #31 [VIMPEL]PAHTERA - BE GUID: 410c30e85647d0727b652d91f734902a
17:43:37 Player [VIMPEL]PAHTERA connected (id=76561198998552502).
17:43:37 BattlEye Server: Verified GUID (410c30e85647d0727b652d91f734902a) of player #31 [VIMPEL]PAHTERA
...
20:33:15 Player [VIMPEL]PAHTERA disconnected.
20:33:15 BattlEye Server: Player #31 [VIMPEL]PAHTERA disconnected

I have noticed something new, players can now trigger OnUserDisconnected without an OnUserConnected event if they haven't loaded required mods.
server rpt

17:44:35 File 'server_root\@RHSGREF\addons\rhsgref_a29.pbo' not found.
17:44:35 BEServer::finishDestroyPlayer(364172745): users.get failed
17:44:36 "TEST [DEBUG] Player any (364172745) left"
This comment was removed by BIS_fnc_KK.
BIS_fnc_KK added a comment.EditedMay 25 2023, 7:48 AM

it should have fired after

20:33:15 Player [VIMPEL]PAHTERA disconnected.

so either you are not running profile exe or haven’t added the EH

Add another

addMissionEventHandler ["OnUserDisconnected", {diag_log _this}];

that prints directly into rpt

I double checked, it is in profiling. So it should appear between

20:33:15 Player [VIMPEL]PAHTERA disconnected.
...here
20:33:15 BattlEye Server: Player #31 [VIMPEL]PAHTERA disconnected

Post your server log

I just did another look at the server rpt and it looks like its happening after the game is over and #mission xxx gets called, which then causes the mod to unregister the eventhandlers, I totally forgot it did this now. I assume there's no way to get it to work with preStart = 1 in function library since it makes use of addMissionEventHandler

The mission has to exist for mission event handler to be used. But there is another onUserDisconnected EH that can be added via server.cfg https://community.bistudio.com/wiki/Arma_3:_Server_Side_Scripting

ewenjo added a subscriber: ewenjo.May 26 2023, 3:04 PM

Thanks, I'll look into it. Event handler seems to be working correctly though 👍