ID:2403778
 
Resolved
Animating filters could, in some rare cases, cause a crash.
BYOND Version:512.1448
Operating System:Linux
Web Browser:Firefox 62.0
Applies to:Dream Daemon
Status: Resolved (512.1453)

This issue has been resolved.
Descriptive Problem Summary:
DreamDaemon crashes frequently. It will run fine for a few hours and then abruptly decide to crash.

Numbered Steps to Reproduce Problem:
1. Open DreamDaemon.
2. Host game.
3. Wait 2 hours - 48 hours.
4. Crash.

Code Snippet (if applicable) to Reproduce Problem:
Not code, but this is this is the messages received.
BUG: Sequence number D3AA expected but   42 received
BUG: Crashing due to an illegal operation!

Backtrace for BYOND 512.1448 on Linux:
Generated at Sun Oct 7 13:18:38 2018

DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804bb84]
libbyond.so [0xb71ca000, 0x0], 0x231852
[0xb7780000, 0xb778040c], [0xb7780000, 0xb778040c]
libbyond.so [0xb71ca000, 0x0], 0x231852
libbyond.so [0xb71ca000, 0x0], 0x291403
libbyond.so [0xb71ca000, 0x0], 0x291f68
libbyond.so [0xb71ca000, 0x0], 0x2a5135
libbyond.so [0xb71ca000, 0x0], 0x2a7c20
libbyond.so [0xb71ca000, 0x0], 0x25b449
libbyond.so 0x386000, 0x38611a
libbyond.so 0x34af20, 0x34b122
DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804ae94]
libc.so.6 0x19440, 0x19533 (__libc_start_main)
DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804a791]


Expected Results:
The server not crashing.

Actual Results:
The server crashes.

Does the problem occur:
Every time? Or how often? 2-48 hours of uptime, most consistently.
In other games? No.
In other user accounts? Yes.
On other computers? Yes.


When does the problem NOT occur?
Problem did not occur for +8 months until recently.


Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
510 version worked fine.

Workarounds:
Putting the server back up frequently.
The sequence error has nothing to do with this crash. The problem appears to be happening in animate() and has something to do with animating a filter, but it's hard to narrow down the exact issue. Can you point out parts of the code that animate filters?
Hi, it seems to be happening when animating filters within the dash code - which changed a bit since the report, but still seems to cause the crashes. We can provide the core file as neccessary [though current code did not provide a crash log as the other one].

Code snippets in question:

                    while(Distance>0)
var/travel_angle = dir2angle(get_dir(src, src.Target))
animate(src.filters[filters.len], x=sin(travel_angle)*8, y=cos(travel_angle)*8, time=Delay)
step_to(src,src.Target)
if(get_dist(src,src.Target)==1)
Distance=0
src.dir=get_dir(src,src.Target)
if(src.Target.Knockbacked)
src.Attacking=0
src.Target.StopKB()
src.Target.Frozen=1
spawn(10)
src.Target.Frozen=0
Distance-=1
sleep(Delay)
src.Juggernaut-=1
src.Skimming-=1
src.Attacking=0
src.Frozen=0
src.icon_state=""
animate(src.filters[filters.len], x=0, y=0)
src.dir=get_dir(src,src.Target)


filter is a simple motion blur filter that's added to every mob on generation

src.filters += filter(type="motion_blur", x=0,y=0)

what changed between the last time the issue and now is that the GetAngle and atan2 functions were dropped for a simpler dir2angle which simply assigns an angle value based on the direction between both mobs
You need to put <dm> ... </dm> to make it readable. All your tabs are getting lost so I can't read or use your code at all.
Thanks, I forgot the exact command so I tried <code> at first and that obviously didn't work too well, so I resorted to plain text.
It took some sleuthing, but I finally found the cause of this.

It looks like the core issue was that you had a bunch of references to filters in use, maybe sticking around in another var somewhere, so it was growing the array of refs. The code wasn't handling that growth case properly, hence the crash.

This never came out in previous testing because it's not really expected that a bunch of dangling refs will stick around.
Lummox JR resolved issue with message:
Animating filters could, in some rare cases, cause a crash.