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 freeze after ragdoll removal #110

Open
CaptainPRICE opened this Issue Sep 22, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@CaptainPRICE

CaptainPRICE commented Sep 22, 2017

Steps to reproduce

  1. Ragdoll a player (ulx ragdoll Console command).
  2. Remove a newly created prop_ragdoll entity (Entity.Remove).
  3. ???
  4. Profit.

Expected behavior

No crash.

Actual behavior

Client crashes. Everything about the player entity is removed, however a player is still connected to the server. Unable to do anything (with exception). The only (easy) way to fix the crashed client/server state, is to restart client's GMod (hl2) process. (It is possible to recover without a client restart; requires hackery.)
This also poses a security issue, there are addons which rely on IsValid check, and if a "player" is invalid, then it makes an assumption that it is a (server) "Console", and thus "free access has been granted to the highest permission set"... (This is especially applied to the serverside Console commands.)

Error(s) in player's console, if any

[tooo... too much spam is being generated on the clientside upon a ragdoll removal, from all kinds of addons]
[ERROR] lua/includes/extensions/util.lua:38: attempt to call method 'GetAimVector' (a nil value)

  1. GetPlayerTrace - lua/includes/extensions/util.lua:38
  2. Run - gamemodes/base/gamemode/cl_targetid.lua:8
  3. HUDPaint - gamemodes/base/gamemode/cl_init.lua:75
    4. unknown - gamemodes/sandbox/gamemode/cl_init.lua:75
    [...]

Console (extra) stuff

] lua_run PrintTable(ents.FindByClass("prop_ragdoll"))
> PrintTable(ents.FindByClass("prop_ragdoll"))...
1	=	Entity [67][prop_ragdoll]
] lua_run Entity(67):Remove()
> Entity(67):Remove()...
Warning: Deleting orphaned children of prop_ragdoll
Warning: Deleting orphaned children of player
Warning: Deleting orphaned children of predicted_viewmodel

] ulx unragdoll *
Warning: Player issued command but is now vanished (Command was "unragdoll *")

A player has been garbage collected in Lua, and removed by engine... So, my player is no longer valid:

] lua_run print(table.Count(player.GetAll()))
> print(table.Count(player.GetAll()))...
0

But, using a status Console command, it still show me that I am connected on the server, obviously:

] status
hostname: -
version : 16.12.01/24 6835 insecure
map     : gm_flatgrass at: 0 x, 0 y, 0 z
players : 1 (1 max)

# userid name                uniqueid            connected ping loss state  adr
#      2 "CaptainPRICE"      STEAM_0:0:0         14:14        2    0 active loopback

Version

ULib v2.63d (09/20/17)
ULX v3.73d (03/21/17)

@Nayruden Nayruden changed the title from [Urgent!] Client crash after ragdoll removal to Client freeze after ragdoll removal Sep 25, 2017

@Nayruden

This comment has been minimized.

Show comment
Hide comment
@Nayruden

Nayruden Sep 25, 2017

Member

Removing an entity a player is observing has long been a known bug within GMod. We worked around the problem historically, but it looks like something about how the engine handles it has changed, and now it's worse than it was before.

We will address this, but it is not an urgent issue as originally marked; deleted players are unable to issue commands, and it is in theory difficult for a player to remove themselves in the first place.

Member

Nayruden commented Sep 25, 2017

Removing an entity a player is observing has long been a known bug within GMod. We worked around the problem historically, but it looks like something about how the engine handles it has changed, and now it's worse than it was before.

We will address this, but it is not an urgent issue as originally marked; deleted players are unable to issue commands, and it is in theory difficult for a player to remove themselves in the first place.

@Nayruden Nayruden self-assigned this Sep 25, 2017

@Nayruden Nayruden added the bug label Sep 25, 2017

@CaptainPRICE

This comment has been minimized.

Show comment
Hide comment
@CaptainPRICE

CaptainPRICE Sep 27, 2017

Quick (dirty) way for fixing it:
Upon ulx ragdoll command, simply 'nop' out the Remove function on the ragdoll (Entity) instance (ragdoll.Remove = function() end).
And then upon a ulx unragdoll command, simply restore the Remove function by assigning it to the _R.Entity.Remove (ragdoll.Remove = FindMetaTable("Entity").Remove or _R.Entity.Remove).
(note: _R == debug.getregistry())
I am busy to submit this fix-version PR... But if you do it like I described, please give credit 😄
Sad story: I have been permanently banned from one server because of this, I ran it on all players and all crashed all accidentally.
Thanks ULX.

CaptainPRICE commented Sep 27, 2017

Quick (dirty) way for fixing it:
Upon ulx ragdoll command, simply 'nop' out the Remove function on the ragdoll (Entity) instance (ragdoll.Remove = function() end).
And then upon a ulx unragdoll command, simply restore the Remove function by assigning it to the _R.Entity.Remove (ragdoll.Remove = FindMetaTable("Entity").Remove or _R.Entity.Remove).
(note: _R == debug.getregistry())
I am busy to submit this fix-version PR... But if you do it like I described, please give credit 😄
Sad story: I have been permanently banned from one server because of this, I ran it on all players and all crashed all accidentally.
Thanks ULX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment