Open big excel = crash ahk apk. Why? Strange Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Brazolek123
Posts: 187
Joined: 06 Jun 2016, 16:02

Open big excel = crash ahk apk. Why? Strange

23 Dec 2017, 16:21

Can anyone tell me what might be the reason for such strange behaviour? Got an app that has got like 10k lines. It uses a lot of imagesearch, gdip, some data in arrays, semi-complicated gui with tabs, classics.

While it is in standby it does literally nothing. When I open the script in tray and see what it does theres no any line executed in last 60 seconds. Then I open some random, big excel file (by big I mean 9MB = 9000KB for example). And then after the file is loaded my script crashes. There is loading window for like 10sec and then in the exact moment of main excel window appear everything crashes.

This excel is not related in any way to the app. Not use it, different names, different locations. The only thing in common is that they are both opened in the same time.

The same thing happen if I compile both x32 and x64.

Strange thing, never happen to me before. It is like its in conflict at some low level, I don't know, memory maybe.

This crash also happen if I minimize or maximize some other windows or gui, but less often whereas its always happen with this excel file.
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Open big excel = crash ahk apk. Why? Strange

24 Dec 2017, 14:27

If you could tell me at least your method how you load the excel file into an ahk-variable or array, maybe I could help.
Without this I can only ask like you, how about SetTitlematchMode or #MaxMem or ... or ... or
Einfach nur ein toller Typ. :mrgreen:
User avatar
Brazolek123
Posts: 187
Joined: 06 Jun 2016, 16:02

Re: Open big excel = crash ahk apk. Why? Strange

25 Dec 2017, 00:52

Thing is I do not load this excel file into ahk. Its completely not related to the main ahk apk.
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Open big excel = crash ahk apk. Why? Strange

25 Dec 2017, 01:22

Brazolek123 wrote:Can anyone tell me what might be the reason for such strange behaviour?
Without seeing at least a bit of your code, maybe only David Copperfield or Harry Houdini can tell you the reason.
Your question is more strange than the behaviour of your script.
Einfach nur ein toller Typ. :mrgreen:
User avatar
Brazolek123
Posts: 187
Joined: 06 Jun 2016, 16:02

Re: Open big excel = crash ahk apk. Why? Strange

25 Dec 2017, 05:53

I told you that the script is more than 10k lines, it doesnt use this specific excel in any way. They are not related except for that both of them are opened in the same time in the same pc. How can I know which part of script is responsible for that, if I knew I wouldnt ask in the first place. I'm ask here to get to know if any of you had problems like that and what was the reason.
I want to know if its more likely memory, gui conflict, imagesearch related or else? At this point its pointless to post 10k lines, if I get some direction then I can post "high risk" parts to dont make you waste your time reading everything.

@divanebaba Please stop, this case is obviously different than topics "help control click doesnt work!!1" where you can find solution in the first sight. I belive I provided all necessary informations to point direction at least. Thanks, but you can stop posting this thread.
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Open big excel = crash ahk apk. Why? Strange

25 Dec 2017, 17:09

This is not a private thread.
If you don't want to see my postings, you can use the ignore function in your profile settings.
When you wait for postings, to start correction like a brute force task, good luck.
In your case, a backup file of your app could help.
Einfach nur ein toller Typ. :mrgreen:
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Open big excel = crash ahk apk. Why? Strange

26 Dec 2017, 14:49

Brazolek123 wrote:Then I open some random, big excel file (by big I mean 9MB = 9000KB for example). And then after the file is loaded my script crashes. There is loading window for like 10sec and then in the exact moment of main excel window appear everything crashes.
...
This excel is not related in any way to the app. Not use it, different names, different locations. The only thing in common is that they are both opened in the same time.
...
This crash also happen if I minimize or maximize some other windows or gui, but less often whereas its always happen with this excel file.
I can tell you this behavior is not typical of AHK. I can have dozens of scripts running and open Excel files 10x that size without a problem. But then full crashes on my computer are very rare. Application crashes... yes. But actual Windows crashes are rare. I assume that is what "everything crashes" means. I assume you are not getting an error message or you would post it.

Without know much about your code but the fact it takes 10 seconds to open a 9 MB Excel file would lead me to believe you are running a low level computer. I would guess a memory issue. 10k lines of AHK and 9 MB Excel is still not big in the relative frame of computer applications.

You need to do all the normal Task Manager stuff and see if anything looks like it is using excessive memory or processor time. I would check my AHK for loops that might be doing something unexpected that is using alot of resources. One loop can be much worse than thousands of lines of code.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
Brazolek123
Posts: 187
Joined: 06 Jun 2016, 16:02

Re: Open big excel = crash ahk apk. Why? Strange

27 Dec 2017, 01:31

FanaticGuru wrote:Application crashes... yes. But actual Windows crashes are rare. I assume that is what "everything crashes" means.
Sorry for not being precise. By "everything crashes" I meant that application crashes and typical window appears "Autohotkey 32 has stopped working" and all hidden guis of this app are being shown and gray out. Tonight I will try to prepare proper gif or even yt video to help you guys help me :D Also thinking of attach ram and cpu usage to it.

Thanks for your efforts tho!
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Open big excel = crash ahk apk. Why? Strange

27 Dec 2017, 10:56

Brazolek123 wrote:
FanaticGuru wrote:By "everything crashes" I meant that application crashes and typical window appears "Autohotkey 32 has stopped working" and all hidden guis of this app are being shown and gray out.
My best guess for that type error is that the script is experiencing some type of infinite recursive. A function or subroutine calling itself. Recursive looping behavior going infinite (or very large) will cause a problem. Which is not so much a memory issue as a stack overflow issue.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
Brazolek123
Posts: 187
Joined: 06 Jun 2016, 16:02

Re: Open big excel = crash ahk apk. Why? Strange

27 Dec 2017, 15:25

This is how it looks like:


If there was any infinite loop wouldn't I see it in 'lines most recently executed'? Even if we assume so then how this loop could be activated if I didn't use this specific excel file name in any line?
Last edited by Brazolek123 on 29 Dec 2017, 07:52, edited 1 time in total.
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Open big excel = crash ahk apk. Why? Strange  Topic is solved

27 Dec 2017, 16:58

After watching the video. Again that type crash is most commonly caused by some stack issue in your script.

The script is not crashing but AutoHotkey itself that interprets and processes the script is crashing. If the script "crashed" AutoHotkey would give you an error message and tell you what line in the script caused the crash. That message is Windows telling you that AutoHotkey crashed.

This is typically caused by call stack issues. Call stack issues are normally caused by poor code structuring. Stuff like functions calling themselves, or gosubs without returns, goto jumping out of functions or gosubs. Process threads creating other processing threads. These things put stuff on stacks which keep track of what called what and where returns should return.

Windows and AutoHotkey have to keep track of all these things. Other programs are also creating threads and putting information on the stack. At some point Windows can say I can't remember all these things at the same time and shut down the application asking it to remember the most stuff to free up its stack of things to remember.

It is possible it could be something totally different or a straight up bug in AutoHotkey that is causing it to crash but without knowing your coding skill level I assume it is something that is poorly structured in your script as that is the most common cause I have seen.

These stack issues don't really show up as memory or processor usage. And they can cause a problem even when the script is not actively doing anything.

I hand you 9 things to hold for me as I open a cab door, you do assuming I will take them right back once I am in the cab, but instead I drive away saying thanks for holding my stuff, later at McDonalds the cashier hands you a tray and a drink, you stuggle but just can't hold it all so you give up and let my stuff crash to the ground and leave me a sorry note. I am no where around when the crash happens but I should have never expected you to hold my stuff forever.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Holarctic, mikeyww, robnicholson, Rohwedder, Swiftly9767 and 351 guests