Bug Debug log from r11927 when autoadventuring

Magus_Prime

Well-known member
I had just adventured manually, via the relay browser, to clear the stat warning, at The Pond. Dressed as a Hippy during the IsleWar.

I then tried to auto-adventure in the same location and got a debug log. After generating the log KoLMafia continued and cleared The Pond.

View attachment DEBUG_20130226.txt
 

roippi

Developer
relevant code bits:

Code:
			istream = this.formConnection.getInputStream(); // (1)
			this.responseCode = this.formConnection.getResponseCode();

			//Handle HTTP 3xx Redirections
			if ( this.responseCode > 300 && this.responseCode < 309 )
			{
				this.redirectMethod = this.formConnection.getRequestMethod(); // (2)

Two things trouble me about this debug log. First, the line that threw an NPE is inside the block that handles HTTP 3xx redirections, which AFAIK shouldn't be happening when autoadventuring. Second, (and others check my logic on this), the NPE was thrown at (2) when to my logic, if this.formConnection were null the NPE should really have been thrown at (1). There's something I'm not understanding.
 

Veracity

Developer
Staff member
Am I going to be derided for suggesting that GenericRequest isn't thread safe?
Considering this:

Code:
	public static boolean isRatQuest = false;
	public static boolean isBarrelSmash = false;
	public static boolean handlingChoices = false;
	public static boolean ascending = false;
	public static String itemMonster = null;
	public static boolean choiceHandled = true;
	private static boolean suppressUpdate = false;
it clearly is not.

Do you believe that one of those variables being manipulated in multiple threads is the cause of the error reported here?
 

Catch-22

Active member
Do you believe that one of those variables being manipulated in multiple threads is the cause of the error reported here?

It's more likely to be one of these:

Code:
	public int responseCode;
	public String responseText;
	public HttpURLConnection formConnection;
	public String redirectLocation;
	public String redirectMethod;

Edit: Here's a debug log from when I managed to have a RequestThread execute out of the order the requests were issued in, but I was unable to reproduce it.
 

Attachments

  • DEBUG_20130227a.txt
    2.5 KB · Views: 44
Last edited:

roippi

Developer
Thread interference is more or less the only conclusion I can come to as well. Unfortunately.
 

Veracity

Developer
Staff member
OK, so you are saying that there are multiple threads executing the same request.
That would be a problem.
 

roippi

Developer
Seems unlikely I'll admit, but I don't have any other explanation for why the NPE was thrown where it was.
 
Top