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

Both server and client crash, AI related #7188

Closed
SamuXarick opened this issue Feb 6, 2019 · 4 comments
Labels

Comments

@SamuXarick
Copy link
Contributor

@SamuXarick SamuXarick commented Feb 6, 2019

Version of OpenTTD

2019-02-06-master-gbfdad9ad1b

Expected result

No crash

Actual result

Crash

Steps to reproduce

1 - on server, start multiplayer non-dedicated server game with 14 AIs set up, with 250000 #opcodes, build speed set to very fast, and a start_date of 0 on every AI.
2 - on client, join server as Spectator while not all companies have started yet.
3 - on server, open AI Debug Window, click Reload on one of the AIs. If it doesn't crash right away, try Reload on another AI, until one of them crashes.
4 - on client, a timeout of 20 seconds is displayed, then it crashes after that, I suppose when exiting to main menu, not sure.

crash.log
crash.log

2019-02-06 4
Left = server, Right = client

@SamuXarick

This comment has been minimized.

Copy link
Contributor Author

@SamuXarick SamuXarick commented Feb 7, 2019

[00:00] for the client crash, I think the problem is here at network_client.cpp line 1176 and 1174 should be switched
[00:01] CloseConnection makes _networking = false, and when the save occurs, it is already saving with no network
[00:01] there is no instance running on the client, only on the server
[00:01] should save empty

/* 20 seconds are (way) more than 4 game days after which
* the server will forcefully disconnect you. */
if (lag > 20) {
this->NetworkGameSocketHandler::CloseConnection();
ShowErrorMessage(STR_NETWORK_ERROR_LOSTCONNECTION, INVALID_STRING_ID, WL_CRITICAL);
ClientNetworkEmergencySave();
return;
}

There are two emergency saves. Shouldn't 1 be enough? CloseConnection does an emergency save, then another is done after the error message. Is that the intention? Even the error message is repeated.

@glx22

This comment has been minimized.

Copy link
Contributor

@glx22 glx22 commented Feb 7, 2019

4fb76db added the function, and the extra call it seems.

@glx22

This comment has been minimized.

Copy link
Contributor

@glx22 glx22 commented Feb 7, 2019

And for the server crash, I think some test must be added to

if (c == NULL || c->ai_instance == NULL) return;

SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Feb 7, 2019
…d an AI save crash when doing an emergency network save.
SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Mar 1, 2019
…d an AI save crash when doing an emergency network save.
SamuXarick added a commit to SamuXarick/OpenTTD that referenced this issue Mar 4, 2019
@stale

This comment has been minimized.

Copy link

@stale stale bot commented Apr 8, 2019

This issue has been automatically marked as stale because it has not had any activity in the last two months.
If you believe the issue is still relevant, please test on the latest nightly and report back.
It will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.