saghul / txiki.js

A tiny JavaScript runtime
MIT License
2.47k stars 165 forks source link

windows: Maximum call stack size exceeded #636

Open ahaoboy opened 1 month ago

ahaoboy commented 1 month ago

I run tjs on a new windows11 24h2 environment and get this error. The precompiled tjs already contains the required dll files. This error is a bit strange. Even if I use source code to compile, I get the same error.

Maximum call stack size exceeded

D:/a/txiki.js/txiki.js/src/vm.c:341:TJS_NewRuntimeInternal: Assertion `(tjs__eval_bytecode(ctx, tjs__polyfills, tjs__polyfills_size, 1)) == (0)' failed.
saghul commented 1 month ago

Oh, so odd!

Can you try making. a debug build with make debug ?

ahaoboy commented 1 month ago

Oh, so odd!

Can you try making. a debug build with make debug ?

Still doesn't work

 make debug

 ./build/tjs.exe
Maximum call stack size exceeded

C:/wt/txiki.js/src/vm.c:341:TJS_NewRuntimeInternal: Assertion `(tjs__eval_bytecode(ctx, tjs__polyfills, tjs__polyfills_size, 1)) == (0)' failed.
saghul commented 1 month ago

So this is just running the executable?

ahaoboy commented 1 month ago

So this is just running the executable?

 ./build/tjs.exe run a.js
Maximum call stack size exceeded

C:/wt/txiki.js/src/vm.c:341:TJS_NewRuntimeInternal: Assertion `(tjs__eval_bytecode(ctx, tjs__polyfills, tjs__polyfills_size, 1)) == (0)' failed.

 ./build/tjs.exe --version
Maximum call stack size exceeded

C:/wt/txiki.js/src/vm.c:341:TJS_NewRuntimeInternal: Assertion `(tjs__eval_bytecode(ctx, tjs__polyfills, tjs__polyfills_size, 1)) == (0)' failed.
saghul commented 1 month ago

What toolchain did you use to build it?

ahaoboy commented 1 month ago

msys2 mingw64

The files uploaded from ci cannot be executed either. I suspect it is caused by the new system update. The one that could run normally before was Windows 23H2.

https://github.com/saghul/txiki.js/actions/runs/9936893898

 make --version
GNU Make 4.4.1
Built for x86_64-pc-msys
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

 gcc --version
gcc.exe (Rev1, Built by MSYS2 project) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 ldd tjs
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffe3da80000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffe3ba80000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffe3b1f0000)
        ADVAPI32.dll => /c/WINDOWS/System32/ADVAPI32.dll (0x7ffe3bbc0000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffe3d0d0000)
        sechost.dll => /c/WINDOWS/System32/sechost.dll (0x7ffe3d6e0000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7ffe3c710000)
        ole32.dll => /c/WINDOWS/System32/ole32.dll (0x7ffe3cf30000)
        msvcp_win.dll => /c/WINDOWS/System32/msvcp_win.dll (0x7ffe3b010000)
        dbghelp.dll => /c/WINDOWS/SYSTEM32/dbghelp.dll (0x7ffe29fb0000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7ffe3b7b0000)
        IPHLPAPI.DLL => /c/WINDOWS/SYSTEM32/IPHLPAPI.DLL (0x7ffe397f0000)
        GDI32.dll => /c/WINDOWS/System32/GDI32.dll (0x7ffe3bb50000)
        ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0xe00000)
        win32u.dll => /c/WINDOWS/System32/win32u.dll (0x7ffe3b620000)
        combase.dll => /c/WINDOWS/System32/combase.dll (0x7ffe3c330000)
        gdi32full.dll => /c/WINDOWS/System32/gdi32full.dll (0x7ffe3b0c0000)
        USER32.dll => /c/WINDOWS/System32/USER32.dll (0x7ffe3d790000)
        OLEAUT32.dll => /c/WINDOWS/System32/OLEAUT32.dll (0x7ffe3d960000)
        SHELL32.dll => /c/WINDOWS/System32/SHELL32.dll (0x7ffe3c830000)
        WS2_32.dll => /c/WINDOWS/System32/WS2_32.dll (0x7ffe3bcb0000)
        USERENV.dll => /c/WINDOWS/SYSTEM32/USERENV.dll (0x7ffe3a3d0000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x7ffe26f20000)
        libcurl-4.dll => /mingw64/bin/libcurl-4.dll (0x7ffe043a0000)
        CRYPT32.dll => /c/WINDOWS/System32/CRYPT32.dll (0x7ffe3ae90000)
        bcrypt.dll => /c/WINDOWS/SYSTEM32/bcrypt.dll (0x7ffe3a800000)
        WLDAP32.dll => /c/WINDOWS/System32/WLDAP32.dll (0x7ffe3d420000)
        libffi-8.dll => /mingw64/bin/libffi-8.dll (0x7ffe26f00000)
        libbrotlidec.dll => /mingw64/bin/libbrotlidec.dll (0x7ffe14910000)
        libidn2-0.dll => /mingw64/bin/libidn2-0.dll (0x7ffe09b20000)
        libcrypto-3-x64.dll => /mingw64/bin/libcrypto-3-x64.dll (0x7ffd99ec0000)
        libnghttp2-14.dll => /mingw64/bin/libnghttp2-14.dll (0x7ffe0d430000)
        libnghttp3-9.dll => /mingw64/bin/libnghttp3-9.dll (0x7ffe04f20000)
        libssh2-1.dll => /mingw64/bin/libssh2-1.dll (0x7ffe04ea0000)
        libssl-3-x64.dll => /mingw64/bin/libssl-3-x64.dll (0x7ffe03ec0000)
        libpsl-5.dll => /mingw64/bin/libpsl-5.dll (0x7ffe04ef0000)
        zlib1.dll => /mingw64/bin/zlib1.dll (0x7ffe04e70000)
        libbrotlicommon.dll => /mingw64/bin/libbrotlicommon.dll (0x7ffe04910000)
        libiconv-2.dll => /mingw64/bin/libiconv-2.dll (0x7ffdbcfa0000)
        libzstd.dll => /mingw64/bin/libzstd.dll (0x7ffdbdbe0000)
        libintl-8.dll => /mingw64/bin/libintl-8.dll (0x7ffe048d0000)
        libunistring-5.dll => /mingw64/bin/libunistring-5.dll (0xe00000)
        CRYPTBASE.DLL => /c/WINDOWS/SYSTEM32/CRYPTBASE.DLL (0x7ffe3a5d0000)
        libunistring-5.dll => /mingw64/bin/libunistring-5.dll (0x7ffdbcb30000)
        dbgcore.DLL => /c/WINDOWS/SYSTEM32/dbgcore.DLL (0x7ffdca250000)
saghul commented 1 month ago

Thanks for the heads up, I'll take a look!

saghul commented 1 month ago

Out of curiosity, can you try running the executable with --stack-size XXX and increase the value to see if it starts to work?

ahaoboy commented 1 month ago

Out of curiosity, can you try running the executable with --stack-size XXX and increase the value to see if it starts to work?

Not work


  ./build/tjs.exe --version --stack-size 100000 --memory-limit 100000 --trace
Maximum call stack size exceeded

C:/wt/txiki.js/src/vm.c:341:TJS_NewRuntimeInternal: Assertion `(tjs__eval_bytecode(ctx, tjs__polyfills, tjs__polyfills_size, 1)) == (0)' failed.```
saghul commented 1 month ago

OK, I guess there is no escaping on me creating a Windows 11 VM πŸ˜…

saghul commented 1 month ago

Out of curiosity. Can you run the REPL in QuickJS-ng just fine? https://github.com/quickjs-ng/quickjs

ahaoboy commented 1 month ago

Out of curiosity. Can you run the REPL in QuickJS-ng just fine? https://github.com/quickjs-ng/quickjs

I suspect it has something to do with my development environment settings, but I'm not sure what I've changed that's causing the problem.

 win…\quickjs-ng ξ‚°  master 
 ./build/qjs.exe
QuickJS-ng - Type ".help" for help
qjs >
saghul commented 1 month ago

Good to know, thanks for testing!

Not sure it's your environment, since getting the binaries from the CI also fails...

ahaoboy commented 4 weeks ago

OK, I guess there is no escaping on me creating a Windows 11 VM πŸ˜…

I installed a win11 24H2 virtual machine using virtualbox, and it's ok, so it seems that this problem only occurs on my computer :(

saghul commented 4 weeks ago

Oh now that is very weird!