asumagic / kag-staging

Issue tracker for the KAG staging build
6 stars 0 forks source link

Non-informative crash when trying to run TC on localhost #120

Closed jammer312 closed 1 year ago

jammer312 commented 3 years ago
terminate called after throwing an instance of 'char const*'
./runlocalhost.sh: line 19: 25003 Aborted                 (core dumped) ./KAG noautoupdate nolauncher autostart Scripts/localhost.as

Core dump: https://disk.yandex.com/d/cES2_vqk4LSKVA Can't really tell anything about it since there are no debug symbols in KAG executable

Ubuntu 20.04.1 64bit, 3570-render2d-v2

asumagic commented 3 years ago

I have the same thing happen occasionally when rejoining servers. Exceptions like that are typically from the AS JIT.

Most likely this one is because an allocated code page in the JIT is too small to fit a big-ass function in the mod, or because of some other odd issue.

Newer staging versions will print the exception when this occurs.

asumagic commented 3 years ago

This is caused by the way code pages are allocated. The kernel is free to place code pages about everywhere in the address space, but the AS JIT was not designed to allow branch jumps larger than 2GB. There is a simple workaround I will be testing that is to pass MAP_32BIT to mmap, which forces code pages to be allocated on the first 4GB, which has absolutely not been intended for this purpose, but should work.

Should:tm: be fixed in the next revision.

asumagic commented 2 years ago

Fixed for linux, but still happens on win64

asumagic commented 1 year ago

This is caused by the way code pages are allocated. The kernel is free to place code pages about everywhere in the address space, but the AS JIT was not designed to allow branch jumps larger than 2GB. There is a simple workaround I will be testing that is to pass MAP_32BIT to mmap, which forces code pages to be allocated on the first 4GB, which has absolutely not been intended for this purpose, but should work.

Should™️ be fixed in the next revision.

This was a lie and was not the actual cause, which should now be fixed.