basro / hx-jsasync

Haxe lib for generating native JS async functions in an ergonomic and type safe way.
24 stars 4 forks source link

Uncaught exception Stack overflow #6

Open rb1147x opened 3 years ago

rb1147x commented 3 years ago

I receive an Uncaught exception Stack overflow randomly. This 1000+ line error message appears in the Problems tab within VScode:

C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:109: characters 24-67 : Uncaught exception Stack overflow
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:1: character 1 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:126: characters 14-27 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:147: characters 35-39 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:126: characters 14-27 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:155: characters 34-38 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:126: characters 14-27 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:147: characters 35-39 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:126: characters 14-27 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:155: characters 34-38 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:126: characters 14-27 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:305: characters 13-17 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:167: characters 29-54 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:126: characters 14-27 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:169: characters 56-69 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:126: characters 14-27 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:305: characters 13-17 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/ExprTools.hx:167: characters 29-54 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:126: characters 14-27 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:129: characters 10-19 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:163: characters 10-39 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:46: characters 16-44 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Helper.hx:27: characters 10-48 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:109: characters 24-67 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/Context.hx:51: characters 10-36 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:72: characters 5-58 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:166: characters 15-37 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:31: characters 44-72 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/JSAsync.hx:17: characters 10-50 : Called from here
...

Unfortunately the message just repeats... And my application compiles successfully. So far, any runtime errors don't appear to be associated with jsasync.

Not sure how helpful this info is to find the error, but hopefully this is a start.

I'm also using Haxe 4.1.5.

Thanks.

basro commented 3 years ago

I've seen this happen before. Usually restarting the language server fixes it for me. In vs code you can do this by pressing Ctrl+Shift+P and type Haxe: Restart Language Server

It might be a bug in my code but I've not found a way to reproduce this consistently so I haven't been able to debug it. If you find a way to reproduce it consistently please let me know, it would be very helpful.

basro commented 3 years ago

I've taken a look at that call stack and there's something quite fishy...

These three lines:

C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:109: characters 24-67 : Called from here
C:\Program Files\Haxe Toolkit\haxe\std/haxe/macro/Context.hx:51: characters 10-36 : Called from here
C:\Program Files\Haxe Toolkit\haxe\lib\jsasync/1,2,1/src/jsasync/impl/Macro.hx:72: characters 5-58 : Called from here

Macro.hx:72 is Context.error("JSASync: " + error.message, error.pos); and Context.hx:51 is Context.error indeed.

How could Context.error end up triggering a call to JSAsync.build which is the function in line 109 is the question.

This might be a bug in the Haxe language server.

rb1147x commented 3 years ago

@Gama11 you work on the Haxe language server right? Any thoughts on the above error?

Thanks.