[Fixed] A_RemoveLight causes crash

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

A_RemoveLight causes crash

Postby Rip and Tear » Fri Aug 16, 2019 8:53 am

Calling A_RemoveLight can cause the game to crash completely (not a VM abort). GZDoom 4.2.0 / macOS 10.14.6

I attached a WAD file to use for testing the bug.

1. Start the game
2. Type `netevent attachlight` in the console
3. Type `netevent removelight` in the console
(close the console between each of these so the game can unpause)

Repeat until the game crashes (usually takes me 2-5 tries). Moving around seems to help, also.

There are also weird rendering artifacts that appear, but I wasn't able to get a screenshot because they only show up for a few frames.
Attachments
AttachLightTest.wad
(483 Bytes) Downloaded 17 times
User avatar
Rip and Tear
I <3 ZScript
 
Joined: 02 May 2017
Operating System: Mac OS X 10.8 or later
Graphics Processor: Intel (Modern GZDoom)

Re: A_RemoveLight causes crash

Postby _mental_ » Sat Aug 17, 2019 4:55 am

There are two related problems here.

The main issue is RemoveLight() function. It deletes an entry from AActor::UserLights while AActor::AttachedLights still contains dynamic light created from that removed entry.
The minor issue is the light attachment happens on state change. If this is not the case (e.g. stand still player in this sample), a light won't appear until player moves/shoots/whatever.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: A_RemoveLight causes crash

Postby Graf Zahl » Sat Aug 17, 2019 5:04 am

I think the SetDynamicLights call needs to be moved to a place after Tick has run - with each place where lights change only flagging the needed change - to avoid redoing this more often than necessary.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A_RemoveLight causes crash

Postby _mental_ » Sat Aug 17, 2019 5:47 am

This is fine, although I would like to fix the main issue first. I don't really get where lights should be removed from AttachedLights. At the moment, they seem to be removed during actors destruction only.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: A_RemoveLight causes crash

Postby Graf Zahl » Sun Aug 18, 2019 5:47 am

AttachedLights will be taken care of when the current list of active lights gets created in SetDynamicLights. Since that isn't called when no state change takes place between setting/removing the light, the list of attached lights will be stale in that case and contain incorrect data.

This actually is a bit more tricky. Since the AttachLight function family can be called from outside the actor, the only fix is to only set a flag, and once the game ticker has completed running, process all actors that got flagged for a light change.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A_RemoveLight causes crash

Postby Graf Zahl » Sun Aug 18, 2019 6:44 am

Fixed.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A_RemoveLight causes crash

Postby Rip and Tear » Tue Sep 17, 2019 10:23 pm

I am still experiencing this issue as of GZDoom 4.2.1.
User avatar
Rip and Tear
I <3 ZScript
 
Joined: 02 May 2017
Operating System: Mac OS X 10.8 or later
Graphics Processor: Intel (Modern GZDoom)

Re: A_RemoveLight causes crash

Postby Graf Zahl » Wed Sep 18, 2019 1:10 am

Same demo mod? When I last tried it it worked.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A_RemoveLight causes crash

Postby drfrag » Wed Sep 18, 2019 5:18 am

For me it doesn't crash in the latest master.
User avatar
drfrag
I.R developer, I.R smart
Vintage GZDoom Developer
 
Joined: 23 Apr 2004
Location: Spain

Re: A_RemoveLight causes crash

Postby Rachael » Wed Sep 18, 2019 8:12 am

Sounds like you have something else loaded that is causing issues, and probably should be reported as a new bug so that it can also get fixed, too.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: A_RemoveLight causes crash

Postby Rip and Tear » Wed Sep 18, 2019 8:07 pm

Yes, I tested it with the same demo wad and the -noautoload command line parameter.

It may be a macOS specific issue.
User avatar
Rip and Tear
I <3 ZScript
 
Joined: 02 May 2017
Operating System: Mac OS X 10.8 or later
Graphics Processor: Intel (Modern GZDoom)

Re: A_RemoveLight causes crash

Postby _mental_ » Thu Sep 19, 2019 12:09 am

What was the exact build version?
_mental_
 
 
 
Joined: 07 Aug 2011

Re: A_RemoveLight causes crash

Postby Rip and Tear » Thu Sep 19, 2019 10:36 am

_mental_ wrote:What was the exact build version?

Just the release version of 4.2.1. Not sure how to get any more specific than that.
User avatar
Rip and Tear
I <3 ZScript
 
Joined: 02 May 2017
Operating System: Mac OS X 10.8 or later
Graphics Processor: Intel (Modern GZDoom)

Re: A_RemoveLight causes crash

Postby _mental_ » Thu Sep 19, 2019 1:27 pm

It was fixed after 4.2.1 was released.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: A_RemoveLight causes crash

Postby Rip and Tear » Thu Sep 19, 2019 8:44 pm

_mental_ wrote:It was fixed after 4.2.1 was released.

I must be missing something here, since this bug report was closed on August 18th and GZDoom 4.2.1 was released September 10th.
User avatar
Rip and Tear
I <3 ZScript
 
Joined: 02 May 2017
Operating System: Mac OS X 10.8 or later
Graphics Processor: Intel (Modern GZDoom)

Next

Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests