Bug - Fixed Chat doesn't work cleanly in CLI or headless modes

Grotfang

Developer
This is sort of both a feature request and a bug report:

Feature Request:

Screenshot for illustration.

With the new updates allowing us to parse chat using chatbot scripts, and receive maps of people present, I don't think it should still be essential to open these frames if we are running mafia using the --CLI argument.

Bug Report:

When running mafia headless, I get the following. First (bottom report) is from entering "chat" into the CLI. Subsequent ones are when messages are found. (I think resolving the above would also resolve this -- is that right? -- since running headless also involves running mafia under the --CLI argument):

Code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lmafia v14.3 r8959, Linux, Java 1.5.0_07
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread. If you
 would like the dev team to look at it, please write a bug report
 at kolmafia.us. Include specific information about what you were
 doing when you made this and include the log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Mon Jan 31 19:50:14 PST 2011
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.awt.HeadlessException: null
java.awt.HeadlessException
        at
java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
        at java.awt.Window.<init>(Window.java:317)
        at java.awt.Frame.<init>(Frame.java:419)
        at java.awt.Frame.<init>(Frame.java:384)
        at javax.swing.JFrame.<init>(JFrame.java:150)
        at
net.sourceforge.kolmafia.swingui.GenericFrame.<init>(GenericFrame.java:125)
        at
net.sourceforge.kolmafia.swingui.ChatFrame.<init>(ChatFrame.java:87)
        at
net.sourceforge.kolmafia.chat.ChatManager.openWindow(ChatManager.java:541)
        at
net.sourceforge.kolmafia.chat.ChatManager.processChannelEnable(ChatManager.java:355)
        at
net.sourceforge.kolmafia.chat.ChatManager.processMessage(ChatManager.java:264)
        at
net.sourceforge.kolmafia.chat.ChatManager.processMessages(ChatManager.java:250)
        at
net.sourceforge.kolmafia.chat.ChatSender.sendRequest(ChatSender.java:239)
        at
net.sourceforge.kolmafia.chat.ChatSender.sendMessage(ChatSender.java:179)
        at
net.sourceforge.kolmafia.chat.ChatSender.sendMessage(ChatSender.java:138)
        at
net.sourceforge.kolmafia.chat.ChatPoller.getEntries(ChatPoller.java:105)

            KoLmafia v14.3 r8959, Linux, Java 1.5.0_07
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread. If you
 would like the dev team to look at it, please write a bug report
 at kolmafia.us. Include specific information about what you were 
 doing when you made this and include the log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Mon Jan 31 19:50:14 PST 2011
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.awt.HeadlessException: null
java.awt.HeadlessException
	at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
	at java.awt.Window.<init>(Window.java:317)
	at java.awt.Frame.<init>(Frame.java:419)
	at java.awt.Frame.<init>(Frame.java:384)
	at javax.swing.JFrame.<init>(JFrame.java:150)
	at net.sourceforge.kolmafia.swingui.GenericFrame.<init>(GenericFrame.java:125)
	at net.sourceforge.kolmafia.swingui.ChatFrame.<init>(ChatFrame.java:87)
	at net.sourceforge.kolmafia.chat.ChatManager.openWindow(ChatManager.java:541)
	at net.sourceforge.kolmafia.chat.ChatManager.processChannelEnable(ChatManager.java:355)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessage(ChatManager.java:264)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessages(ChatManager.java:250)
	at net.sourceforge.kolmafia.chat.ChatSender.sendRequest(ChatSender.java:239)
	at net.sourceforge.kolmafia.chat.ChatSender.sendMessage(ChatSender.java:179)
	at net.sourceforge.kolmafia.chat.ChatSender.sendMessage(ChatSender.java:138)
	at net.sourceforge.kolmafia.chat.ChatPoller.getEntries(ChatPoller.java:105)
	at net.sourceforge.kolmafia.chat.ChatPoller.run(ChatPoller.java:71)


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
            KoLmafia v14.3 r8959, Linux, Java 1.5.0_07
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread. If you
 would like the dev team to look at it, please write a bug report
 at kolmafia.us. Include specific information about what you were 
 doing when you made this and include the log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Mon Jan 31 19:51:13 PST 2011
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.awt.HeadlessException: null
java.awt.HeadlessException
	at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
	at java.awt.Window.<init>(Window.java:317)
	at java.awt.Frame.<init>(Frame.java:419)
	at java.awt.Frame.<init>(Frame.java:384)
	at javax.swing.JFrame.<init>(JFrame.java:150)
	at net.sourceforge.kolmafia.swingui.GenericFrame.<init>(GenericFrame.java:125)
	at net.sourceforge.kolmafia.swingui.ChatFrame.<init>(ChatFrame.java:87)
	at net.sourceforge.kolmafia.chat.ChatManager.openWindow(ChatManager.java:541)
	at net.sourceforge.kolmafia.chat.ChatManager.processChannelEnable(ChatManager.java:355)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessage(ChatManager.java:264)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessages(ChatManager.java:250)
	at net.sourceforge.kolmafia.chat.ChatSender.sendRequest(ChatSender.java:239)
	at net.sourceforge.kolmafia.chat.ChatSender.sendMessage(ChatSender.java:179)
	at net.sourceforge.kolmafia.chat.ChatSender.sendMessage(ChatSender.java:138)
	at net.sourceforge.kolmafia.chat.ChatPoller.getEntries(ChatPoller.java:105)
	at net.sourceforge.kolmafia.chat.ChatPoller.run(ChatPoller.java:71)


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
            KoLmafia v14.3 r8959, Linux, Java 1.5.0_07
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread. If you
 would like the dev team to look at it, please write a bug report
 at kolmafia.us. Include specific information about what you were 
 doing when you made this and include the log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Tue Feb 01 01:58:38 PST 2011
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.awt.HeadlessException: null
java.awt.HeadlessException
	at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
	at java.awt.Window.<init>(Window.java:317)
	at java.awt.Frame.<init>(Frame.java:419)
	at java.awt.Frame.<init>(Frame.java:384)
	at javax.swing.JFrame.<init>(JFrame.java:150)
	at net.sourceforge.kolmafia.swingui.GenericFrame.<init>(GenericFrame.java:125)
	at net.sourceforge.kolmafia.swingui.ChatFrame.<init>(ChatFrame.java:87)
	at net.sourceforge.kolmafia.chat.ChatManager.openWindow(ChatManager.java:541)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessage(ChatManager.java:298)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessages(ChatManager.java:250)
	at net.sourceforge.kolmafia.chat.ChatSender.sendRequest(ChatSender.java:239)
	at net.sourceforge.kolmafia.chat.ChatSender.sendMessage(ChatSender.java:179)
	at net.sourceforge.kolmafia.chat.ChatSender.sendMessage(ChatSender.java:126)
	at net.sourceforge.kolmafia.chat.ChatSender.sendMessage(ChatSender.java:105)
	at net.sourceforge.kolmafia.textui.RuntimeLibrary.chat_private(RuntimeLibrary.java:3879)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at net.sourceforge.kolmafia.textui.parsetree.LibraryFunction.execute(LibraryFunction.java:119)
	at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:166)
	at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:451)
	at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:129)
	at net.sourceforge.kolmafia.textui.Interpreter.executeScope(Interpreter.java:265)
	at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:198)
	at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:191)
	at net.sourceforge.kolmafia.chat.ChatManager.processCommand(ChatManager.java:485)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessage(ChatManager.java:280)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessages(ChatManager.java:250)
	at net.sourceforge.kolmafia.chat.ChatPoller.getEntries(ChatPoller.java:143)
	at net.sourceforge.kolmafia.chat.ChatPoller.run(ChatPoller.java:71)


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
            KoLmafia v14.3 r8959, Linux, Java 1.5.0_07
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread. If you
 would like the dev team to look at it, please write a bug report
 at kolmafia.us. Include specific information about what you were 
 doing when you made this and include the log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Tue Feb 01 01:58:45 PST 2011
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.awt.HeadlessException: null
java.awt.HeadlessException
	at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
	at java.awt.Window.<init>(Window.java:317)
	at java.awt.Frame.<init>(Frame.java:419)
	at java.awt.Frame.<init>(Frame.java:384)
	at javax.swing.JFrame.<init>(JFrame.java:150)
	at net.sourceforge.kolmafia.swingui.GenericFrame.<init>(GenericFrame.java:125)
	at net.sourceforge.kolmafia.swingui.ChatFrame.<init>(ChatFrame.java:87)
	at net.sourceforge.kolmafia.chat.ChatManager.openWindow(ChatManager.java:541)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessage(ChatManager.java:298)
	at net.sourceforge.kolmafia.chat.ChatManager.processMessages(ChatManager.java:250)
	at net.sourceforge.kolmafia.chat.ChatPoller.getEntries(ChatPoller.java:143)
	at net.sourceforge.kolmafia.chat.ChatPoller.run(ChatPoller.java:71)
 

Grotfang

Developer
This patch solves *my* issues, but I wonder if there's a nicer way of retaining info on CLI arguments. I don't want to commit this, but if someone could comment on whether they feel there is a better way to get similar functionality (or maybe this isn't functionality that's wanted in the first place) then could you speak up?

Many thanks

View attachment CLIChat.patch
 

holatuwol

Developer
I added the "chat" command specifically to open a chat window from CLI mode (since chat is usually all I do), so I'd prefer that this not be committed.

That being said, you can do a System.getProperty("java.awt.headless") for truly headless environments?
 

Grotfang

Developer
That would be good too. I run it headless on a linux server, but assumed the CLI was intended to mimic that. Whoops.

If I replace all my KoLmafia.useGUI statements with System.getProperty( "java.awt.headless" ).equals( "true" ) would that cover everything that needs covering? I'm just trying to make sure that everything someone would want server-side (so... accessible via ASH) is going to run cleanly without debug logs.
 
Last edited:

Grotfang

Developer
Hola -- headless mode is actually broken.

Windows doesn't seem to want to output the error log, so a summary:

ChatManager [line 92] calls >> ContactListFrame [line 70] calls >> GenericFrame [line 125] >> calls JFrame. I assume since this looks like it's the trivia game that this isn't intentional?
 
Last edited:

Veracity

Developer
Staff member
I pinged hola about this. It would be nice to have this fixed before I spin 14.4.1 - which I intend to do as soon as someone gives me the info I need about how recalling skills in Bad Moon works from the new account menu ...
 

holatuwol

Developer
Whoops, I've been away from the computer (well, anything not work related) since the start of the lunar new year, I'll look into this ASAP.
 

Veracity

Developer
Staff member
Hola released revision 9011: "9011: Fix inability to startup KoLmafia with -Djava.awt.headless=true".
 

Grotfang

Developer
Sorry -- been away over the weekend, so only just read this. It's a good fix -- mafia now logs in. who_clan() still throws headless exceptions, but I can fix that elsewhere now the program can actually log in. Cheers!

EDIT: I'm being dim. Set useContactsFrame to false and it's perfect. Fantastic!
 
Last edited:
Top