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

Fix script error related to dropship and player server leave #914

Merged
merged 5 commits into from
Feb 1, 2025

Conversation

Bobbyperson
Copy link
Contributor

@Bobbyperson Bobbyperson commented Jan 13, 2025

If a player leaves the same frame they enter the dropship, the server will crash. This is due to the SetVelocity line.

Code review:

It's a one line change

Testing:

Testing isn't needed, it's literally just an OnDestroy.

@github-actions github-actions bot added needs testing Changes from the PR still need to be tested needs code review Changes from PR still need to be reviewed in code labels Jan 13, 2025
@Zanieon
Copy link
Contributor

Zanieon commented Jan 13, 2025

This is odd, is this still related to that old recurrent issue we talked about the Dropship crash after i reworked its script file? FirstPersonSequence function Is unlikely to be the real problem, if you got the callstacks in those crashes, check the functions that calls this one and see if they don't have a missing player.EndSignal( "OnDestroy" ) on themselves, usually that EndSignal is what prevents crashes regarding invalid players in threaded functions.

@Bobbyperson
Copy link
Contributor Author

Bobbyperson commented Jan 13, 2025

[04:46:13] [NORTHSTAR] [info] Player Spungussie disconnected: "Disconnect by user."
[04:46:13] [SCRIPT SV] [info] [ParseableLog] {"subject":{"type":"player","name":"Spungussie","playerIndex":2,"teamId":3,"uid":"1001311332166","ping":2424919,"kills":9,"deaths":0,"alive":true,"titan":false,"location":{"type":"vector","x":-1400.48,"y":-2021.84,"z":1079.96}},"verb":"disconnected"}
[04:46:13] [NORTHSTAR] [info] Player Spungussie disconnected: "Disconnect by user."
[04:46:13] [NORTHSTAR] [warn] attempted to write pdata of size 0!
[04:46:13] [SCRIPT SV] [info] SCRIPT ERROR: [SERVER] Attempted to call SetVelocity on invalid entity
[04:46:13] [SCRIPT SV] [info]  -> player.SetVelocity( <0,0,0> ) // fix this
[04:46:13] [SCRIPT SV] [info]
CALLSTACK
*FUNCTION [FirstPersonSequence()] _anim.gnut line [1034]

[04:46:13] [SCRIPT SV] [info] LOCALS
[ent] ENTITY (npc_dropship #NPC_EVAC_DROPSHIP [94] (NPC "npc_dropship" at <-1390.19 -2022.07 1142.11>))
[player] ENTITY (NULL)
[sequence] unknown struct
[this] TABLE

This callstack isn't too useful, but perhaps it's AddPlayerToEvacDropship in _evac.gnut? It seems to be missing a player.EndSignal( "OnDestroy" ).

@Zanieon
Copy link
Contributor

Zanieon commented Jan 13, 2025

This callstack isn't too useful, but perhaps it's AddPlayerToEvacDropship in _evac.gnut? It seems to be missing a player.EndSignal( "OnDestroy" ).

Looks like it's that actually, i just checked it myself, and that function does 2 calls of that function the first unthreaded one makes AddPlayerToEvacDropship wait for its entire execution to only then proceed with logic below, which means if someone disconnects during that time, the second call, the threaded one will crash the server because invalid player.

@Bobbyperson
Copy link
Contributor Author

There's a lot of random files with inconsistent tabs and spaces or like random double tabs in different places. Would a PR to do a simple formatting check over the whole repo be unwelcome? Maybe add a simple CI as well.

@ASpoonPlaysGames
Copy link
Contributor

There's a lot of random files with inconsistent tabs and spaces or like random double tabs in different places. Would a PR to do a simple formatting check over the whole repo be unwelcome? Maybe add a simple CI as well.

Having a format check for squirrel has been something that has been wanted for a while now

@GeckoEidechse
Copy link
Member

Would a PR to do a simple formatting check over the whole repo be unwelcome? Maybe add a simple CI as well.

This has been my number one request for like 2 years btw. See R2Northstar/Northstar#681

Copy link
Contributor

@Zanieon Zanieon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good so far now, gj!

@Zanieon Zanieon added almost ready to merge Apart from any small remaining other issues addressed by other labels, this would be ready to merge and removed needs code review Changes from PR still need to be reviewed in code labels Jan 15, 2025
@GeckoEidechse GeckoEidechse changed the title Fix: dropship crash Fix script error related to dropship and player server leave Jan 16, 2025
@Bobbyperson
Copy link
Contributor Author

Don't know if my testing counts, but I've been running this on my server for two weeks with no problems.

@Zanieon Zanieon added READY TO MERGE This mergeable right now and removed needs testing Changes from the PR still need to be tested almost ready to merge Apart from any small remaining other issues addressed by other labels, this would be ready to merge labels Jan 28, 2025
@Zanieon Zanieon merged commit 007cb92 into R2Northstar:main Feb 1, 2025
3 checks passed
@Bobbyperson Bobbyperson deleted the dropship-crash branch February 2, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
READY TO MERGE This mergeable right now
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants