Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUA Error: empty queue/time issue #1439

Closed
yuk75 opened this issue Aug 13, 2018 · 10 comments
Closed

LUA Error: empty queue/time issue #1439

yuk75 opened this issue Aug 13, 2018 · 10 comments

Comments

@yuk75
Copy link

yuk75 commented Aug 13, 2018

So I have a game where staff are getting stuck in rooms and it's been causing patients to die...like the staff are frozen and they are in the room just waiting. I reloaded and it didn't help so I removed the doctors and placed them back down, didn't change things they acted like they couldn't get to their desk (this one was a GP). So I removed the doc from the room and sent the patient in question to be treated, then reloaded the game just in case. Later on my game stopped responding (everything except UI frozen) and I minimised to see an error in the console window which I will put here, it's probably not related? But I thought I should also mention the issue prior in the off chance it is related...



---------------------------------------------------------------

Welcome to CorsixTH v0.62!

---------------------------------------------------------------

This window will display useful information if an error occurs.

---------------------------------------------------------------

Checking for CorsixTH updates...
You are running the latest version of CorsixTH.
An error has occurred!
Almost anything can be the cause, but the detailed information below can help th
e developers find the source of the error.
Running: The timer handler.
A stack trace is included below, and the handler has been disconnected.
Lua\entities\humanoid.lua:868: Action queue was empty. This should never happen.

humanoid - class: Standard Male Patient
Warmth: 0.258   Happiness: 1.000   Fatigue: 0.000  Thirst: 0.231  Toilet_Need: 0
.239   Health: 0.000
Actions: []
stack traceback:
        [C]: in function 'error'
        Lua\entities\humanoid.lua:868: in method 'getCurrentAction'
        Lua\hospital.lua:690: in method 'countSittingStanding'
        Lua\hospital.lua:720: in method 'checkFacilities'
        Lua\hospital.lua:974: in method 'onEndDay'
        Lua\world.lua:998: in method 'onTick'
        Lua\app.lua:1014: in function <Lua\app.lua:1011>
        (...tail calls...)
        Lua\app.lua:915: in function <Lua\app.lua:910>

Warning: No event handler for timer

My gamelog.txt

Created game with savegame version 111.
Savegame version is 111 (v0.60), originally it was 111 (v0.60)
Savegame version is 111 (v0.60), originally it was 111 (v0.60)
Warning: Trying to remove nonexistant room build callback (function: 000000000FCE33B0) from humanoid (table: 0000000010280890).
Warning: Trying to remove nonexistant room remove callback (function: 0000000004D1F180) from humanoid (table: 0000000010280890).
Warning: Trying to remove nonexistant room build callback (function: 000000000593FB50) from humanoid (table: 000000001027E510).
Warning: Trying to remove nonexistant room remove callback (function: 00000000149B0C50) from humanoid (table: 000000001027E510).
Warning: Trying to remove nonexistant room build callback (function: 000000001622F7C0) from humanoid (table: 000000001450B5B0).
Warning: Trying to remove nonexistant room remove callback (function: 0000000004AECD00) from humanoid (table: 000000001450B5B0).
Warning: Trying to remove nonexistant room build callback (function: 0000000016C21380) from humanoid (table: 000000000FD77410).
Warning: Trying to remove nonexistant room remove callback (function: 000000000483C330) from humanoid (table: 000000000FD77410).
Warning: Trying to remove nonexistant room build callback (function: 0000000016AFF960) from humanoid (table: 0000000015C38FB0).
Warning: Trying to remove nonexistant room remove callback (function: 0000000004AEC460) from humanoid (table: 0000000015C38FB0).
Warning: Trying to remove nonexistant room build callback (function: 0000000016AFFA80) from humanoid (table: 0000000005159980).
Warning: Trying to remove nonexistant room remove callback (function: 0000000004AEC9A0) from humanoid (table: 0000000005159980).
Warning: Trying to remove nonexistant room build callback (function: 0000000016AFFAE0) from humanoid (table: 000000000E3D2DB0).
Warning: Trying to remove nonexistant room remove callback (function: 0000000004AECD60) from humanoid (table: 000000000E3D2DB0).
Warning: Trying to remove nonexistant room build callback (function: 000000001622A360) from humanoid (table: 000000000E71E7F0).
Warning: Trying to remove nonexistant room remove callback (function: 00000000104DC900) from humanoid (table: 000000000E71E7F0).
Warning: Trying to remove nonexistant room build callback (function: 000000000F82E170) from humanoid (table: 00000000150088F0).
Warning: Trying to remove nonexistant room remove callback (function: 0000000010584CD0) from humanoid (table: 00000000150088F0).
Warning: Trying to remove nonexistant room build callback (function: 00000000142E1930) from humanoid (table: 000000000FF4D970).
Warning: Trying to remove nonexistant room remove callback (function: 000000000EB574A0) from humanoid (table: 000000000FF4D970).
Warning: Trying to remove nonexistant room build callback (function: 0000000016BB7A40) from humanoid (table: 000000000040E000).
Warning: Trying to remove nonexistant room remove callback (function: 0000000004A93270) from humanoid (table: 000000000040E000).
Savegame version changed from 111 (v0.60) to 127 (v0.62). The save was created using 111 (v0.60)
Warning: Trying to remove nonexistant room build callback (function: 0000000018B82B00) from humanoid (table: 0000000016FC94C0).
Warning: Trying to remove nonexistant room remove callback (function: 000000000CD91C40) from humanoid (table: 0000000016FC94C0).
Warning: Trying to remove nonexistant room build callback (function: 0000000018631700) from humanoid (table: 0000000016FC69C0).
Warning: Trying to remove nonexistant room remove callback (function: 0000000018A713C0) from humanoid (table: 0000000016FC69C0).
Savegame version is 127 (v0.62), originally it was 111 (v0.60)
Warning: Trying to remove nonexistant room build callback (function: 000000001737A220) from humanoid (table: 0000000013DD47A0).
Warning: Trying to remove nonexistant room remove callback (function: 00000000188EC750) from humanoid (table: 0000000013DD47A0).
Savegame version is 127 (v0.62), originally it was 111 (v0.60)
Savegame version is 127 (v0.62), originally it was 111 (v0.60)
Error in timer handler: 
Lua\entities\humanoid.lua:868: Action queue was empty. This should never happen.
humanoid - class: Standard Male Patient
Warmth: 0.258   Happiness: 1.000   Fatigue: 0.000  Thirst: 0.231  Toilet_Need: 0.239   Health: 0.000
Actions: []
stack traceback:
	[C]: in function 'error'
	Lua\entities\humanoid.lua:868: in method 'getCurrentAction'
	Lua\hospital.lua:690: in method 'countSittingStanding'
	Lua\hospital.lua:720: in method 'checkFacilities'
	Lua\hospital.lua:974: in method 'onEndDay'
	Lua\world.lua:998: in method 'onTick'
	Lua\app.lua:1014: in function <Lua\app.lua:1011>
	(...tail calls...)
	Lua\app.lua:915: in function <Lua\app.lua:910>

I have a possible autosave?
https://drive.google.com/file/d/1A5SDkMoXRrvVs6UXSbm4cCziWys3yON9/view?usp=sharing

Save immediately after event (while no one was moving but UI would let me save)
https://drive.google.com/file/d/1DmTIF_p82brNERwveBBslPzBC02_ieiB/view?usp=sharing

@yuk75
Copy link
Author

yuk75 commented Aug 13, 2018

This seems to be affecting the save from point of load, and the autosave from maybe a minute in. There's no way to continue playing it.

@TheCycoONE
Copy link
Member

Is it the original save game from 0.60 with the issue, or did it happen later while playing with 0.62?

@yuk75
Copy link
Author

yuk75 commented Aug 13, 2018

I think the original save is from 2014 so probably yes. Is that an issue? :)

@TheCycoONE
Copy link
Member

My question was, did that save have the issue before you ran it in v0.62, or only after playing awhile after?

@mugmuggy
Copy link
Contributor

Patient is queued for decontamination shower. Health as in the dump is 0 so they were to die.

They are using bench, have a walk action to the decontamination room, and a meander and die action in the queue.

Upon entering the room the queue changes to only; walk to shower, idle and use object.

Whilst on the bench the patient already has self.going_home = true and therefore repeats the issue in #1431 of an empty action queue. This is loading the 0.60 save into master.

Note clicking the patient doesn't bring up the UI, whereas other patients it does because

if not epidemic or
(not epidemic.coverup_in_progress or
(not self.infected or self.marked_for_vaccination) and
not epidemic.vaccination_mode_active) then
ui:addWindow(UIPatient(ui, self))

I'm not sure on a few other things, like the patient is infected, and diagnosed but hasn't met diagnosis policy, and not all diagnosis rooms yet visited, epidemic counter has counted down, and the announcement is about to come through of epidemic discovery. Not sure if any of these items contributed.

@yuk75
Copy link
Author

yuk75 commented Aug 14, 2018

I'm not sure how to answer that question. I played this specific level about 8 times now with no problems, it's only been this specific time that the issue has happened. If I click to restart the level I don't see it happen. Is that what you wanted to know? :D

@mugmuggy
Copy link
Contributor

I believe I can replicate circumstances around this. Place bench in front of door ( immediately in front, ie closest that you can place it, facing the door)

For now I don't understand the when and how exactly a use object, queue, walk (which is must_happen = true, this could be a 0.60 thing, could be something else that affects it but haven't so far replicated the must_happen in master from a new game) circumstance arises but thats what is needed. Wait til a patient is queued and seated. I just set attributes["health"] to just above the threshold and let it count down, and if needed tweak must_happen, can also call Patient:die as attributes only count down on endDay.

Patient receives meander and die actions. Health is at 0. Place doctor in room, patient will leave bench and enter room, meander and die actions are dropped from action queue. Patient then continues to be processed as normal, but comfort stats will not as the die method set going_home to true and tickDay no longer processes.

The difference here is that the decontamination shower hits the error as they are supposed to be dying (going_home).

Picking up the bench in this case and having the patient move to another bench, you can set going_home to false and call Patient:die and they will die (even with must_happen == true). It's only if the patient is using the bench in front of the door, that causes them to not move on (with the must_happen walk). I was able to replicate in the same save with different rooms/patients on master just not new.

@mugmuggy
Copy link
Contributor

mugmuggy commented Aug 17, 2018

Think I worked out the circumstances that leads to the must_happen. When the patient is say walking to the room and a check of patient thirst results in the heading to drinks machine, the original walk action is interrupted. That results in the truncation of the current walk, walk to drinks machine, use drinks machine and requeue of the current walk action. The original walk action to the room will have action_walk_start run with

  action.saved_must_happen = action.must_happen
  action.must_happen = true

So the must_happen was false to start with (from Room:createEnterAction), but once started will be true. When the drinks machine tasks interrupts the walk its not referring to the saved_must_happen, but must_happen which is now true and the requeue of the walk action to the room copies that.

When the QueueAction and the walk to enter room is requeued the walk action specifically uses saved_must_happen, hence if not interrupted by the drinks machine, the queuing gets must_happen = false.

Once in the incorrect state and the proximity of the door in the process, the original issue just requeues the patient, even though the patient is 'dead' and should wander off and die. If a patient is one more tile away, logic somewhere allows them to wander off and die instead when they reach the next tile.

@mugmuggy
Copy link
Contributor

mugmuggy commented Jan 3, 2019

Just making note here that in the PR it was noted there was some code in need of a refactor. I believe I have another issue that could be addressed at the same time with that refactor and documenting it here for the future.

Any interrupted walk, like those original ones here will also unexpect the humanoid from the target room.

-- Unexpect the patient from a possible destination room.
if humanoid.next_room_to_visit then
local door = humanoid.next_room_to_visit.door
if door.queue then
door.queue:unexpect(humanoid)
door:updateDynamicInfo()
end
end

We probably need to alter the current actions is_entering after requeuing the original entering walk and modifying that if next room check to include an is_entering check. That probably includes some other cases, like already handled with SeekToilets elsewhere.

@mugmuggy
Copy link
Contributor

Refactor was included in #1565

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants