Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client gets kicked for invalid packet when joining large map with a new company #8761

Open
ldpl opened this issue Feb 27, 2021 · 2 comments
Open
Labels
needs triage This issue needs further investigation before it becomes actionable

Comments

@ldpl
Copy link
Contributor

ldpl commented Feb 27, 2021

Version of OpenTTD

master (4fd2eec)

Expected result

Join successfully

Actual result

*** Player has left the game (received invalid or unexpected packet)

Steps to reproduce

  1. Start a server with a large enough map. It should be big enough for bug to manifest but not enough for the client to get disconnected for too long download.
  2. Upause the game, disable network.pause_on_join
  3. Start a client, select server, join with "new company" button

As far as I can tell it happens because client creates company on SERVER_MAP_DONE and it gets created before the client has a chance to catch up with the server. CmdCompanyCtrl sends CLIENT_SET_PASSWORD that fails because client still has STATUS_PRE_ACTIVE on the server.

Var dumps from NetworkServer_Tick:

CLIENT 15 status 0 lag 0
CLIENT 15 status 4 lag 0
CLIENT 15 status 6 lag 0
...
CLIENT 15 status 6 lag 0
CLIENT 15 status 6 lag 1
...
CLIENT 15 status 6 lag 182
CLIENT 15 status 7 lag 183
...
CLIENT 15 status 7 lag 322
CLIENT 15 status 8 lag 0
...
CLIENT 15 status 8 lag 0
CLIENT 15 status 8 lag 1
...
CLIENT 15 status 8 lag 145

TCP stream:


28:00:02:32:30:32:31:30:32:32:37:2d:6d:61:73:74:65:72:2d:6d:34:66:64:32:65:65:63:62:38:62:00:64:6d:00:1b:64:50:00:fe:00
    CLIENT_JOIN(2) {'network_revision': b'20210227-master-m4fd2eecb8b', 'newgrf_version': 453012836, 'client_name': b'dP', 'join_as': 254, 'language': 0}
2c:00:0c:0c:00:00:00:02:13:83:de:39:34:61:32:37:34:39:34:61:37:33:39:62:62:63:64:33:30:37:34:32:62:66:65:63:64:37:65:62:61:35:31:00
    SERVER_WELCOME(12) {'client_id': 12, 'password_seed': 3733132034, 'password_server_id': b'94a27494a739bbcd30742bfecd7eba51'}
0b:00:0d:01:00:00:00:00:64:50:00
    SERVER_CLIENT_INFO(13) {'client_id': 1, 'playas': 0, 'name': b'dP'}
03:00:0e
    CLIENT_GETMAP(14) {}
07:00:10:f1:0f:00:00
    SERVER_MAP_BEGIN(16) {'frame_counter': 4081}
[1460] b4:05:12:4f:54:54:58:01:21:00:00:fd:37:7a:58:5a:00:00:01:69:22:de:36:02:00:21:01:12:00:00:00:23:b8:87:2c:e5:96:2c:ef:ff:5d:00:23:93:06:21:06:9c:df:72...

...

[863] 5f:03:12:5e:04:04:86:34:b9:0b:bf:0f:01:5f:19:68:05:46:4e:1a:a7:2a:35:3b:59:6d:ed:4e:75:2d:0e:a4:6f:5e:7d:44:ea:91:f4:a9:96:3d:7a:e4:b7:61:46:e9:33:e9...
    SERVER_MAP_DATA(18) <map data>
03:00:13
    SERVER_MAP_DONE(19) {'data': b''}
03:00:14
    CLIENT_MAP_OK(20) {}
16:00:19:ff:51:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
    CLIENT_COMMAND(25) {'company_id': 255, 'cmd': COMPANY_CTRL(81), 'p1': 0, 'p2': 0, 'tile': 0}
0c:00:16:e1:11:00:00:e1:11:00:00:8c
    SERVER_FRAME(22) {'counter': 4577, 'counter_max': 4577, 'token': 140}
0b:00:18:e1:11:00:00:75:8c:12:27
    SERVER_SYNC(24) {'frame_counter': 4577, 'sync_seed_1': 655527029}
0e:00:0d:0c:00:00:00:fe:64:50:20:23:31:00
    SERVER_CLIENT_INFO(13) {'client_id': 12, 'playas': 254, 'name': b'dP #1'}
07:00:15:0c:00:00:00
    SERVER_JOIN(21) {'client_id': 12}
05:00:24:0f:12
    SERVER_CONFIG_UPDATE(36) {'max_companies': 15, 'max_spectators': 18}
05:00:23:03:00
    SERVER_COMPANY_UPDATE(35) {'company_passworded_bitmap': 3}
0e:00:0d:0c:00:00:00:03:64:50:20:23:31:00
    SERVER_CLIENT_INFO(13) {'client_id': 12, 'playas': 3, 'name': b'dP #1'}
12:00:1c:0a:0c:00:00:00:00:00:04:00:00:00:00:00:00:00
    SERVER_CHAT(28) {'action': 10, 'client_id': 12, 'self_send': False, 'msg': b'', 'data': 4}
1b:00:1a:ff:51:00:00:00:00:00:00:00:0c:00:00:00:00:00:00:00:00:00:e2:11:00:00:01
    SERVER_COMMAND(26) {'company_id': 255, 'cmd': COMPANY_CTRL(81), 'p1': 0, 'p2': 12, 'tile': 0, 'text': b'', 'callback': 0}
0b:00:16:e2:11:00:00:e2:11:00:00
    SERVER_FRAME(22) {'counter': 4578, 'counter_max': 4578}
20:00:1a:03:37:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:64:50:20:23:31:00:00:e3:11:00:00:00
    SERVER_COMMAND(26) {'company_id': 3, 'cmd': RENAME_PRESIDENT(55), 'p1': 0, 'p2': 0, 'tile': 0, 'text': b'dP #1', 'callback': 0}
0b:00:16:e3:11:00:00:e3:11:00:00
    SERVER_FRAME(22) {'counter': 4579, 'counter_max': 4579}

...

    SERVER_FRAME(22) {'counter': 4600, 'counter_max': 4600}
0b:00:18:f8:11:00:00:5e:63:4e:93
    SERVER_SYNC(24) {'frame_counter': 4600, 'sync_seed_1': 2471387998}
0b:00:16:f9:11:00:00:f9:11:00:00
    SERVER_FRAME(22) {'counter': 4601, 'counter_max': 4601}

...

    SERVER_FRAME(22) {'counter': 4700, 'counter_max': 4700}
0b:00:18:5c:12:00:00:ea:eb:ea:b3
    SERVER_SYNC(24) {'frame_counter': 4700, 'sync_seed_1': 3018517482}
0b:00:16:5d:12:00:00:5d:12:00:00
    SERVER_FRAME(22) {'counter': 4701, 'counter_max': 4701}

...

    SERVER_FRAME(22) {'counter': 4800, 'counter_max': 4800}
0b:00:18:c0:12:00:00:69:de:70:5e
    SERVER_SYNC(24) {'frame_counter': 4800, 'sync_seed_1': 1584455273}
0b:00:16:c1:12:00:00:c1:12:00:00
    SERVER_FRAME(22) {'counter': 4801, 'counter_max': 4801}

...

0b:00:16:23:13:00:00:23:13:00:00
    SERVER_FRAME(22) {'counter': 4899, 'counter_max': 4899}
08:00:17:e1:11:00:00:8c
    CLIENT_ACK(23) {'frame_counter': 4577, 'token': 140}
24:00:21:65:66:63:65:64:64:31:34:62:66:61:38:30:63:37:33:34:62:31:38:38:36:34:64:66:62:34:63:32:34:33:63:00
    CLIENT_SET_PASSWORD(33) {'password': b'efcedd14bfa80c734b18864dfb4c243c'}
16:00:19:03:6a:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
    CLIENT_COMMAND(25) {'company_id': 3, 'cmd': CHANGE_COMPANY_SETTING(106), 'p1': 0, 'p2': 0, 'tile': 0}
0b:00:16:24:13:00:00:24:13:00:00
    SERVER_FRAME(22) {'counter': 4900, 'counter_max': 4900}
0b:00:18:24:13:00:00:16:19:24:8d
    SERVER_SYNC(24) {'frame_counter': 4900, 'sync_seed_1': 2367953174}
04:00:03:07
    SERVER_ERROR(3) {'code': 7}
@TrueBrain TrueBrain added the needs triage This issue needs further investigation before it becomes actionable label Feb 28, 2021
@James103
Copy link
Contributor

@ldpl Do you get a similar error if you try reproducing with the latest (2021-03-23) nightly?

@ldpl
Copy link
Contributor Author

ldpl commented Mar 24, 2021

@James103 And what changed in the latest nightly to affect this bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs further investigation before it becomes actionable
Projects
None yet
Development

No branches or pull requests

3 participants