ID:1986989
 

Problem description:
I'm having a very hard time pinpoint an issue dealing with savefile rollbacks. The rollbacks only happen when the world reboots and everyones characters revert back to when they first saved. Without a reboot everything is normal and just fine. Note that this happens to everyone and even happens in single player mode.
I found a temporary solution which was to add this line before saving.

if(fexists("savefiles/players/[theFolder]/[src.key]/[src.name]")) fdel("savefiles/players/[theFolder]/[src.key]/[src.name]")


After adding that, the savefiles work correctly but it frequently crashes the server. This is the error message that I get before the server crashes

BUG: Finished erasure with refcount=1 (ref=23:7) DM (Character Saving2.dm:152)
BUG: Finished erasure with refcount=1 (ref=23:5) DM (Character Saving2.dm:152)
BUG: Finished erasure with refcount=1 (ref=3:314) DM (Login.dm:64)
BUG: Finished erasure with refcount=1 (ref=23:3) DM (Character Saving2.dm:152)
BUG: Finished erasure with refcount=1 (ref=3:48) DM (Login.dm:64)
BUG: Finished erasure with refcount=1 (ref=23:0) DM (Character Saving2.dm:152)
BUG: Finished erasure with refcount=1 (ref=3:310) DM (Login.dm:64)
BUG: Finished erasure with refcount=1 (ref=23:5) DM (Character Saving2.dm:152)
BUG: Finished erasure with refcount=1 (ref=3:319) DM (Login.dm:64)
BUG: Missing savefile directory .0 (cd=/mob/.0/contents)
BUG: Missing savefile directory .1 (cd=/mob/.0/contents)
BUG: Missing savefile directory .2 (cd=/mob/.0/contents)
BUG: Missing savefile directory .3 (cd=/mob/.0/contents)
BUG: Missing savefile directory .4 (cd=/mob/.0/contents)
BUG: Missing savefile directory .5 (cd=/mob/.0/contents)
BUG: Missing savefile directory .6 (cd=/mob/.0/contents)
BUG: Missing savefile directory .7 (cd=/mob/.0/contents)
BUG: Missing savefile directory .8 (cd=/mob/.0/contents)
BUG: Missing savefile directory .9 (cd=/mob/.0/contents)

        save_char()
if(login>=1)
if(src.inhbtc)
hbtctime-=world.time
if(src.ingravityship)
gravitytime-=world.time
mute-=world.time
src.last_x=src.x
src.last_y=src.y
src.last_z=src.z
var/theFolder=uppertext(copytext(src.key,1,2))
if(fexists("savefiles/players/[theFolder]/[src.key]/[src.name]")) fdel("savefiles/players/[theFolder]/[src.key]/[src.name]")
var/savefile/s=new("savefiles/players/[theFolder]/[src.key]/[src.name]") s["mob"] << src


That's the Character Saving2.dm, the line the error is pointing towards is the if(exists) && fdel() line

mob
Logout()
..()
del(src)

This is the Login.dm, and the error is pointing to the del(src). Do you guys have any idea on where I should look to find the problem. I doubt its references because the rollbacks would happened everytime someones loads not just on reboots, plus those type of problems are fairly easy to solve. If you got any ideas let me know. Thanks you.
Also, after saving and relogining I would notice my file would have a lock file aswell, I think this is the rollback file and when the server reboots it unlocks and overwrites the most recent savefile. Why does the file stay locked and how would I fix this?
Okay, well the issue was completely fixed when I removed
mob
Logout()
..()
del(src)

It doesn't make sense to me why it would interfere with a child logout when it has this ..()
If a child of mob has a Logout() that calls ..(), it means that mob/Logout() will be called. You are deleting the mob before the procedure returns to the child's Logout().
The child Logout() calls ..() after the end of its code which then run the parent Logout above right()? which is where the deletion happens.