Thread: Crash with no console message

1. Crash with no console message

So I moved some code today and it's producing a crash with no console message. Essentially I've narrowed down the cause to calling :IsChanneling() or :IsUsingAbility() on an illusion... I think.
I was calling a module from ItemPurchaseThink() in item_purchase_generic.lua just to keep it updated all the time at a good speed.
The module caches data on enemy heroes and calls a utility function that is meant to find the real hero when illusions are present. The failing chunk in this code is
Code:
for i,v in pairs(tCandidates) do
if v:IsUsingAbility() or v:IsChanneling() then
return v
end
end

I moved the call to the module into the recently added TeamThink() in team_desires.lua and now i just get immediate crash to desktop at the condition checks.
I can print the table tCandidates and get a table of 3 hero handles and v which gets a hero handle and this code did not change and has never had an issue before. Is there something different about calling code from TeamThink()? The following was observed when Chaos Knight picked up an illusion rune

Code:
for i,v in pairs(tCandidates) do
print(v:GetUnitName())
print(v)
print(tCandidates)
if v:IsUsingAbility() or v:IsChanneling() then
print("true")
return v
end
end
produces:
Code:
[VScript] npc_dota_hero_chaos_knight
[VScript] table: 0x0027a7a8 {
[VScript]   [__self] => userdata: 0x0027a7e8
[VScript] }
[VScript]
[VScript] table: 0x004e1ca8 {
[VScript]   [1] => table: 0x004e1ca8 {
[VScript]            [__self] => userdata: 0x0027a7e8
[VScript]          }
[VScript]   [2] => table: 0x004e1ca8 {
[VScript]            [__self] => userdata: 0x004e1ab8
[VScript]          }
[VScript]   [3] => table: 0x004e1ca8 {
[VScript]            [__self] => userdata: 0x004e1b90
[VScript]          }
[VScript] }
and crashes to desktop at the condition checks. This also crashes with manta illusions so pretty easy to reproduce, but this code didn't crash this morning when called in a bots ItemPurchaseThink() now it does in TeamThink()? You need to be able to call these functions on illusions right? Am I missing something?

2. There was a patch today.

I would add a check to make sure "not v:IsNull()" in your code before conditions. Won't fix your issue though.

What are you caching?

3. I am caching as much as I can, my own blend of useful info on allies and enemies, one of which being visible hero handles and if there are illusions to try and guess which of those is real. There is a :IsNull() check in the code that builds tCandidates immediately above the chunk in question.

Also, the problem started before the patch and has not gone away since.

4. Looking at the code and your debug output I don't see any reason why that should be crashing. Do you have a dump file in your steam/dumps folder? That could be really helpful for tracking this down.

5. Yep, I have several from testing. Here is the one from the chaos knight test I posted.

6. Very helpful, thanks, I'll have this fixed for the next update.

7. Awesome thanks

8. Can I ask some questions?
1. If I have most of my castSkillDesire variables in each ability_item_usage_hero_name.lua not declared as local variable, can it trigger a game crash? And if I have the same variable name, for example most of my variable's name for desire casting 1st skill is castQDesire, can it trigger the game crash too?
2. If I have same function name, for example function for casting 1st skill is "function ConsiderQ() ... end;" in each ability_item_usage_hero_name.lua can it trigger a crash?
I'm afraid that can lead to some indexing problem on variable and function that can make the VM goes down? I got such a weird error on crash dump file. Sometimes it prints that error, and sometimes it doesn't when my game crashed.
Code:
14821(2457.393800):  Failed to run script 'C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\dota\scripts\vscripts\bots\ability_item_usage_generic.lua'!
14820(2457.393768):  Script Runtime Error: ...ota\scripts\vscripts\bots\ability_item_usage_generic.lua:3: attempt to call global 'require' (a nil value)
stack traceback:
...ota\scripts\vscripts\bots\ability_item_usage_generic.lua:3: in main chunk
14819(2457.391096):  Failed to run script 'C:\Program Files (x86)\Steam\steamapps\common\dota 2 beta\game\dota\scripts\vscripts\bots\item_purchase_generic.lua'!
14818(2457.391055):  Script Runtime Error: ...ame\dota\scripts\vscripts\bots\item_purchase_generic.lua:6: attempt to call global 'GetBot' (a nil value)
stack traceback:
...ame\dota\scripts\vscripts\bots\item_purchase_generic.lua:6: in main chunk

9. Now I'm getting no error crashes with calling GetNearbyHeroes( 1300, true, BOT_MODE_NONE) when there are illusions present. Is this the same issue? Is the fix for the other issue out yet?

Also, I moved my call out of TeamThink() and back into a bot think and it stops crashing. All of this seems to be related to trying to use some API calls within TeamThink()

10. This is a super bizarre crash. It's crashing because Dire doesn't have a script VM, but it looks like it's running the script function on the Dire script VM.

Do you have a simple script that reproduces this crash?

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•