zhamlin / AHKhttp

HTTP Server
GNU General Public License v2.0
79 stars 21 forks source link

Crashes after a while (memory leak?) #3

Open wywywywy opened 5 years ago

wywywywy commented 5 years ago

Hi,

There's a memory leak somewhere, even when using the example scripts.

After receiving some amount of requests (1000? 2000?) it will crash.

I am not sure if the problem is in AhkHttp.ahk or AhkSock.ahk.

I guess maybe an object or array is not cleared somewhere? I have had a look but couldn't find anything.

Has anyone any idea please?

Thanks.

forbbs commented 5 years ago

too many new() in AHKhttp.ahk.

Akibakki commented 5 years ago

I have the same problem. My script crashes after 1270 - 1290 requests. And I'm not smart enough to solve this, so please help.... ;-(

Kindly Aki

rtayne commented 5 years ago

Has anyone any idea please?

You could try downloading and running the initial commit version https://github.com/zhamlin/AHKhttp/tree/65de0446156ccc4b2a3ed15e7f39d325ba6850db

I believe that when support for binary files was added, a Stack Overflow error was introduced.

Akibakki commented 5 years ago

Yes.... Thanks!!!

I got it working....

Thank you again rtayne

CrashKoeck commented 4 years ago

Yeah, the new Buffer class is definitely where the issue is. I've run a few tests and it always fails between 1,000 and 2,000 requests. I end up getting a "Function recursion limit exceeded" error at line 354 (attached). I'll dig into this myself, but this is a bit beyond my current level in AHK. Any ideas on how to deal with this? Reverting back to the initial commit seems to cause other issues. Screenshot 2020-09-20 023140

CrashKoeck commented 4 years ago

After hunting for a while, found this on the forums that patches the leak - https://www.autohotkey.com/boards/viewtopic.php?t=4890&start=40

In case something happens to the post, attached is the patched and zipped AHKhttp.ahk (full credit to magusneo. I'll put in a pull request with this, but seeing how there have been no responses for quite a while, the updated *.ahk is here.

Note: I've also updated it with the pull request by @bjc5233 to fix the linefeed and variable name bugs. I've also stress tested up to 10K calls and it seemed to be stable vs cashing after less than 2K calls.

AHKhttp.zip

xinxilas commented 3 years ago

After hunting for a while, found this on the forums that patches the leak - https://www.autohotkey.com/boards/viewtopic.php?t=4890&start=40

In case something happens to the post, attached is the patched and zipped AHKhttp.ahk (full credit to magusneo. I'll put in a pull request with this, but seeing how there have been no responses for quite a while, the updated *.ahk is here.

Note: I've also updated it with the pull request by @bjc5233 to fix the linefeed and variable name bugs. I've also stress tested up to 10K calls and it seemed to be stable vs cashing after less than 2K calls.

AHKhttp.zip

At the post, you said it didnt worked afterall? https://www.autohotkey.com/boards/viewtopic.php?p=410391#p410391