Bug Preferences wiped while mafia running

c2t

Member
This might seem similar to the following thread, but I don't think that thread quite fits since it deals specifically with the preference files corrupting: https://kolmafia.us/threads/prefs-file-backup-restore-draft-pr.28887/

So after having my preferences wiped 3 times within just 2 weeks earlier this year, with every time it happening while mafia was running during the emptying storage process, I got around to setting things up to try to catch it in action in debug mode. And it finally bears fruit with the attached files: one being the debug log of the action and the other one being the regular log of the same action. At no point did I do any manual intervention or even noticed that it happened (I have something set up to restore preferences if they are wiped after that action) until I greped my logs looking to see if it happened again, so this is all mafia and script interactions with the game and server in these logs.

If I need to be doing something different to get more details of it happening, let me know what I need to add or do.

Edit: I can also provide debug and log files of the same thing on a different day and without the preferences being wiped if that's wanted for comparison.
 

Attachments

Last edited:
Have not digested everything yet.

Can you build and run from source? Can you reproduce this consistently?

You might try and run https://github.com/kolmafia/kolmafia/pull/1889 and see if you can still reproduce it.

The code in the PR fixes a preferences issue but at the cost of sometimes generating a thread lock. The thread lock has not been reliably reproduced in a test environment. Using the Deck of Every Card often triggers the lock in a live environment.

I have not been able to figure out the issue with the PR but @heeheehee has had some ideas and maybe if your issue is related they will be inspired to make time to revisit this.
 
I do not currently have the ability to run from source. I cannot reproduce this consistently, but emptying storage is the one place where I know it has happened to me more than once, which is why I have been turning debug on before emptying storage and off right after for the last few months to try to catch it.

Another case that I have had happen multiple times where I have seen preferences getting wiped while mafia is running is if I tell mafia to do something while it is timed out from the game. Mafia will start to do the thing I told it to, realize it's not logged in and start doing the login sequence, to include login script, but also do the thing I told it to do simultaneously. I.e. not interrupting what I told it to do so it can run after the login sequence, but both things run in parallel, which I think is weird and I suspect might be part of the problem in this case. However, I've come into the habit of doing a refresh before doing anything in mafia if I haven't touched it for like 5 minutes and I want to do something on it, so that hasn't happened to me in a much longer while than the emptying storage thing. Again, it's not a consistent thing there either, but it has wiped my preferences in that case multiple times for me.

And looking at the log I provided shows that mafia might have been trying to log in while the emptying storage process was happening in game. I don't know if it thought it timed out, or actually timed out, or what, because I don't really know how to read the debug log, but it for sure started the login process while the emptying storage process was happening.
 
OK.

I have never had it happen but... I am doing factoid runs so am emptying storage every few days (because some of my item scripts only look at inventory) and have not seen it. But I always initiate emptying from the relay browser and don't do anything with mafia until mafia thinks it is empty and waits 40 seconds to be sure.

Timing in is also one of those things that doesn't always behave as expected but doesn't misbehave often enough to.

I think this is the bug that is addressed in the PR but that doesn't help you until the PR is trusted.
 
Back
Top