ID:2789458
 
Resolved
In some complex cases where a turf was included in visual contents, adding another object to the same visual contents list could result in an infinite recursion and crash.
BYOND Version:514
Operating System:Windows 10 Pro 64-bit
Web Browser:Firefox 99.0
Applies to:Dream Daemon
Status: Resolved (514.1584)

This issue has been resolved.
Descriptive Problem Summary:
On Aurorastation (SS13 -- https://github.com/Aurorastation/Aurora.3 ) we began to receive reports that the server was crashing, and quickly discovered it was a specific scenario of opening crates in front of mirrors. I was able to reproduce the problem locally, and discovered that it is potentially an engine issue - at least insofar that it crashes silently rather than producing a runtime error.

Mirrors in our and other codebases create an /obj/effect/reflection that adds the turf they are on to vis_contents. They, themselves, are pixel-shifted off the turf prior to adding this turf. Any object that then modifies its vis_contents after the fact will cause an instant CTD if it is done on the /turf that the reflection is watching.

Numbered Steps to Reproduce Problem:
1. Place /atom/movable that manipulates its vis_contents var on a /turf that is in the vis_contents of another /atom/movable pixel-shifted off that turf
2. Activate the new atom's vis_contents manipulation
3. CTD 0xc0000005

Code Snippet (if applicable) to Reproduce Problem:
/atom/movable/atom_test
name = "test atom"

/atom/movable/atom_test/New()
// vis_contents += get_step(src, SOUTH) Has a similar effect, but no crash.
pixel_y = 32
vis_contents += get_turf(src)

/atom/movable/crash_test
name = "crash atom"
icon = 'icons/debug.dmi' // Can be anything
icon_state = "debug"

/atom/movable/crash_test/Click()
vis_contents += new /atom/movable/crash_effect

/atom/movable/crash_effect
name = "test overlay"
icon = 'icons/debug.dmi' // Can be anything
icon_state = "debug_lh"


Expected Results:
The object in question will display in the mirror properly, i.e. reflected with all vis_contents changes applied.

Actual Results:
Immediate crash to desktop once the object applies any changes to its vis_contents.

Does the problem occur:
Every time? Or how often? Every time.
In other games? Unknown.
In other user accounts? Yes.
On other computers? Yes.

When does the problem NOT occur? N/A.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? N/A.

Workarounds: Only way to avoid this is to not have an object add the turf it's "on" to vis_contents.

Can you wrap this up into a little test project? It'll be far easier to suss out the problem if I'm sure we're on the same page.
Sure. This is a link to a simple project - it has an atom_test pixel-shifted and reflecting the turf that crash_test is on, and when crash_test is clicked, BYOND hangs and crashes.

https://drive.google.com/file/d/ 18i3Lc9W8uyarOC6CWE3LCkWKOIHO6hW4/view?usp=sharing
Lummox JR resolved issue with message:
In some complex cases where a turf was included in visual contents, adding another object to the same visual contents list could result in an infinite recursion and crash.