Can't log into KoLmafia

ToughPapaya

New member
Error:
Could not acquire file lock for [username]: java.io.FileNotFoundException: C:\WINDOWS\System32\sessions\active_session.[username] (The system cannot find the path specified)

Version: r27654

OS: Windows 10

Java V17: Installed

So I went to C:\Windows\System32 and there is no sessions folder. I've actually encountered this error across 3 days now (not 3 consecutive days since I haven't been playing every day). The first time, I tried unchecking stealth login with breakfast checked and then I tried unchecking breakfast with stealth login checked. It eventually opened, but I'm not sure what configuration allowed it to open. The second day, I tried both configurations, and it still would not open. I found a thread on the forums saying to go to the folder and delete the file. I could not find the sessions folder, so I reopened KoLmafia to confirm the correct file path and I was somehow able to log in (this was with both stealth login and breakfast checked). I have encountered the error for a third day today and I have confirmed that I indeed don't have a sessions folder. I should mention that I was able to log in without this error in a previous version of KoLmafia. Also, save password has not been checked on any of the three days. What should I do? Is there a solution for this?
 

fronobulax

Developer
Staff member
C:\WINDOWS\System32\ suggests to me that you put the mafia jar file there. That is not a recommended practice because a process typically needs Administrator privileges to write there and that is more than mafia needs. If you want to you could try explicitly running mafia as an Administrator and that should allow mafia to write files and perhaps give you different errors. The preferred solution would be to place mafia in a location where the current user can always create/write files . A subdirectory of Documents is usually a safe choice.
 

ToughPapaya

New member
C:\WINDOWS\System32\ suggests to me that you put the mafia jar file there. That is not a recommended practice because a process typically needs Administrator privileges to write there and that is more than mafia needs. If you want to you could try explicitly running mafia as an Administrator and that should allow mafia to write files and perhaps give you different errors. The preferred solution would be to place mafia in a location where the current user can always create/write files . A subdirectory of Documents is usually a safe choice.

No, I saved it in Documents.
 

fronobulax

Developer
Staff member
No, I saved it in Documents.

And do you launch it by double clicking on it there or some other way?

"Could not acquire file lock for [username]: java.io.FileNotFoundException: C:\WINDOWS\System32\sessions\active_session.[username] (The system cannot find the path specified)" means mafia thinks it's top level directory is C:\WINDOWS\System32\.

If your mafia is in Documsnts/KoLMafia (or similar) does that directory contain things like scripts, data sessions etc?

Do you have any other Java applications that you run from a jar file?

I'm momentarily at a loss.
 

ToughPapaya

New member
And do you launch it by double clicking on it there or some other way?

"Could not acquire file lock for [username]: java.io.FileNotFoundException: C:\WINDOWS\System32\sessions\active_session.[username] (The system cannot find the path specified)" means mafia thinks it's top level directory is C:\WINDOWS\System32\.

If your mafia is in Documsnts/KoLMafia (or similar) does that directory contain things like scripts, data sessions etc?

Do you have any other Java applications that you run from a jar file?

I'm momentarily at a loss.
Yes, I launch it by double clicking on it there. Yes, it contains those folders. No, I don't have any other Java applications.
 

matantisi

New member
I didn't know if I should start a new thread, but I'm having a similar problem. After I play, I log out from the relay browser and then close the mafia window. When I try to login again, I get the message "could not acquire file lock for [name] Most likely, another instance of Kolmafia is logged in". There is definitely not another instance logged in. The only way to log in is to restart the computer, which often isn't convenient. This started about a week or so ago. I haven't added any software to my system. I'm sure it's something small, but I have no idea what it is.
 

fronobulax

Developer
Staff member
What version of mafia?

The file lock files are in the sessions subdirectory. Assuming you are not reporting what turns out to be a newly discovered bug the failure message means mafia cannot get exclusive access to the file. The cause of that is usually another instance of mafia that had not shutdown cleanly or the operating system is denying access for some reason.

"The only way to log in is to restart the computer" doesn't make sense. Perhaps a distinction between logging into KoL and logging in to the computer needs to be made?

If I got the message and was absolutely certain there was no other instance of mafia running, I would run TaskManager and see if there was a Java process running that could be an instance of mafia that did not shut down cleanly.

If there is such a process, kill it, and try mafia again.

Otherwise there are probably more questions that need to be asked :)
 
Top