Bug Exit command has unexpected behaviour

ereinion

Member
Mafia does not exit as it would normally do using the "exit" command in the gcli, when not logged in / mafia is left open overnight. Instead I end up with a blank main pane and a chat window where I'm logged in (see screenshot below). I'm a bit uncertain if I was actually logged in to chat, or if what appeared in the chat window was just a snapshot from when I was briefly logged in, come to think of it.
 

Attachments

  • Screenshot 2022-01-24 080202.png
    Screenshot 2022-01-24 080202.png
    112.9 KB · Views: 7

fronobulax

Developer
Staff member
I am uncertain as to how to try and reproduce.

I started mafia, logged in, ran turns and typed exit in the gCLI. mafia ran my logout script and then shut down.
I started mafia, did not log in, opened the gCLI, typed exit and mafia shut down.
I started mafia, logged in, ran turns, logged out from the menu item, opened a gCLI, typed exit and mafia shut down.

Assuming you did what you said you did I wonder if chat and/or being logged in over rollover are factors? In which case being a little more explicit might help. Thanks.
 

ereinion

Member
In which case being a little more explicit might help.
What information are you looking for?

Mafia was left open over rollover, which I agree might have been part of the issue. I also noticed that before exiting, it logged back in, and I *think* it tried to run svn update and breakfast before exiting, but I wasn't paying very close attention.
 

fronobulax

Developer
Staff member
What information are you looking for?

Mafia was left open over rollover, which I agree might have been part of the issue. I also noticed that before exiting, it logged back in, and I *think* it tried to run svn update and breakfast before exiting, but I wasn't paying very close attention.

So...

You left mafia running.
Rollover happened.
Your next action/interaction was to type exit in the gCLI
"Unexpected things happened".

If I've got the mafia side of things right, rollover triggered a logout.
When you typed exit the first thing mafia tried to do was login.
As part of logging in mafia (may have) done SVN Update and Breakfast.
At some point mafia realized it had a command to process so it started processing exit.

mafia probably got very confused since it was doing start up and shut down things simultaneously.

If the above is correct I'm inclined to say Bug - Won't Fix.

mafia does use blocking - if X is happening then don't do Y - but I'm not sure exactly how I would prevent this. There are valid gCLI interactions that do not require being logged in, "timing in" after rollover is a feature and the list of things that should be blocked during time in may be larger than just the gCLI exit.

Let's see if any other dev has ideas, opinions or sees something obvious that I am overlooking.
 

MCroft

Developer
Staff member
So...

You left mafia running.
Rollover happened.
Your next action/interaction was to type exit in the gCLI
"Unexpected things happened".

If I've got the mafia side of things right, rollover triggered a logout.
When you typed exit the first thing mafia tried to do was login.
As part of logging in mafia (may have) done SVN Update and Breakfast.
At some point mafia realized it had a command to process so it started processing exit.
Does rollover trigger a logout? I don't think it does (or does so silently and I don't see the reconnect). Maybe there's a preference that controls it (he says, not having looked).

How do we know it's rollover, if we've timed-out and lost our session? I'd think the reconnect logic may be involved.

Not that "reconnecting while shutting down" isn't essentially the same as "starting up while shutting down", but it may be a different path to get there.
 

ereinion

Member
I think it is more likely that the logout occurred because the session timed out as Croft suggests, than because of rollover but I haven't looked at the code so either is possible :p

Either way, this isn't something which occurs very frequently for me, as I usually end my sessions before going to bed... Anyhow, I figured it was behavior which should ideally not occur from mafia, so I decided I'd make the devs aware of it by making this thread :)

Whether anyone decides it's worth the effort to hunt down the source of this bug I'll leave up to you all
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Yeah, unfortunately if you don't get any sort of unexpected errors printed, this one is going to be hard for us to track down.
 

fronobulax

Developer
Staff member
Rollover happens after my usual bedtime and decades ago I developed the habit of shutting down programs that I was not actively interacting with so this is one of those things I am unlikely to encounter or be able to test if I tried to fix.
 

Veracity

Developer
Staff member
I remember testing timing in after rollover - back when I added timing in.
It should only time in when you force KoLmafia to make a request of KoL and KoL redirects to login.php.
It is coded to NOT time in if the redirected request was to logout.php.
So the question is, what request does the "exit" command make other than logout.php?
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Perhaps there's a logout script running?
 

ereinion

Member
Yeah, no debug log on the date in question, and a quick look at the session log reveals nothing out of the ordinary there either.

There is a logout-script, and looking at the script it checks what clan the character is in which I assume would trigger a login.
 

VladYvhuce

Member
I'm just in a habit of shutting mafia down right before or at rollover and logging back in at some point after "nightly maintenance" is done.
 

Crowther

Active member
I'm just in a habit of shutting mafia down right before or at rollover and logging back in at some point after "nightly maintenance" is done.
I've gone beyond habit. I have a cron job that does a "kill -HUP" on my mafia during rollover.
 

fronobulax

Developer
Staff member
I have no idea what a cron job is, but I'm assuming "kill -HUP" is a command for it.

A cron job is a Linux (et.al.) command that runs at a certain time - Do this every day at 6 AM. kill -HUP is a command that will stop a process.

So "I have a cron job that does a "kill -HUP" on my mafia during rollover." in context translates as "I have something that stops mafia at a fixed time" whether I am anywhere near the computer or not.
 
Top