[0.12.12] [cube] pcall behavior changed

This subforum contains all the issues which we already resolved.
Post Reply
gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

[0.12.12] [cube] pcall behavior changed

Post by gheift »

When using pcall to catch exceptions, factorio crashes with

Code: Select all

2015-10-21 10:43:20; Factorio 0.12.12 (Build 17122, linux64)
Operating system: Linux
[…]
terminate called after throwing an instance of 'ScriptException'
terminate called recursively
Factorio crashed. Generating symbolized stacktrace, please wait ...
#0  0x7f4e58dd8180 in ?? at ??:0
#1  0x7f4e58dd8107 in ?? at ??:0
#2  0x7f4e58dd94e8 in ?? at ??:0
#3  0xd448dd in __gnu_cxx::__verbose_terminate_handler() at ??:?
Error Util.cpp:61: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
Example code in control.lua:

Code: Select all

local ok, mod = pcall(require, "does_not_exist")
In 0.12.11 this works, in 0.12.12 it does not.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13223
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: 0.12.12: pcall behavior changed

Post by Rseding91 »

Nothing changed with pcall in 0.12.12. In fact pcall still works perfectly in 0.12.12. I use it in my Landfill mod and it works perfectly (just tested).

Something is wrong with the code you've provided. Can you post a full working script that I can run to reproduce the issues you're having that works in 0.12.11 and doesn't work in 0.12.12?

Edit: from what you've posted that's not the correct syntax for pcall: http://www.lua.org/pil/8.4.html
If you want to get ahold of me I'm almost always on Discord.

gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Re: [0.12.12] pcall behavior changed

Post by gheift »

I have created a minimal mod, which crashes my 0.12.12, but not my 0.12.11.

control.lua:

Code: Select all

local ok, mod = pcall(require, "does_not_exist")
The output on starting a new game:

Code: Select all

   0.000 2015-10-21 11:13:27; Factorio 0.12.12 (Build 17122, linux64)
   0.000 Operating system: Linux
   0.000 Program arguments: "./bin/x64/factorio" 
   0.000 Read data path: /home/gheift/.local/opt/factorio.pcall/data
   0.000 Write data path: /home/gheift/.local/opt/factorio.pcall
   0.000 Binaries path: /home/gheift/.local/opt/factorio.pcall/bin
   0.054 Available display adapters: 1
   0.054  [0]: resolution 1920x1200px at [0,0]
   0.054 Create display on adapter 0. Size 1280x720 at position [310, 222]. Monitor 0
   0.148 Initialised OpenGL:[0] Mesa DRI Intel(R) Ivybridge Desktop ; driver: 3.0 Mesa 10.6.8
   0.175 Graphics options: [FullScreen: false] [VSync: true] [UIScale: 100%] [MultiSampling: OFF] [Graphics quality: normal] [Video memory usage: all] [Screen: 0]
   0.205 Loading mod core 0.0.0 (data.lua)
   0.207 Loading mod base 0.12.12 (data.lua)
   0.247 Loading mod pcall-test 0.0.1 (data.lua)
   0.596 Initial atlas bitmap size is 8192
   0.612 Created atlas bitmap 8192x8190
   0.612 Created atlas bitmap 8192x7002
   6.645 Factorio initialised
  12.794 Info Scenario.cpp:123: Map version 0.12.12-0
terminate called after throwing an instance of 'ScriptException'
terminate called recursively
Factorio crashed. Generating symbolized stacktrace, please wait ...
#0  0x7fccde064180 in ?? at ??:0
#1  0x7fccde064107 in ?? at ??:0
#2  0x7fccde0654e8 in ?? at ??:0
#3  0xd448dd in __gnu_cxx::__verbose_terminate_handler() at ??:?
  12.876 Error Util.cpp:61: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
Attachments
pcall-test_0.0.1.zip
(716 Bytes) Downloaded 147 times

gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Re: [0.12.12] pcall behavior changed

Post by gheift »

Another test case, which crashes the new version:

control.lua:

Code: Select all

local ok, mod = pcall(function()error"foo"end)
Log:

Code: Select all

   0.000 2015-10-21 11:19:11; Factorio 0.12.12 (Build 17122, linux64)
   0.000 Operating system: Linux
   0.000 Program arguments: "./bin/x64/factorio" 
   0.000 Read data path: /home/gheift/.local/opt/factorio.pcall/data
   0.000 Write data path: /home/gheift/.local/opt/factorio.pcall
   0.000 Binaries path: /home/gheift/.local/opt/factorio.pcall/bin
   0.057 Available display adapters: 1
   0.057  [0]: resolution 1920x1200px at [0,0]
   0.057 Create display on adapter 0. Size 1280x720 at position [310, 222]. Monitor 0
   0.137 Initialised OpenGL:[0] Mesa DRI Intel(R) Ivybridge Desktop ; driver: 3.0 Mesa 10.6.8
   0.162 Graphics options: [FullScreen: false] [VSync: true] [UIScale: 100%] [MultiSampling: OFF] [Graphics quality: normal] [Video memory usage: all] [Screen: 0]
   0.187 Loading mod core 0.0.0 (data.lua)
   0.188 Loading mod base 0.12.12 (data.lua)
   0.224 Loading mod pcall-test 0.0.2 (data.lua)
   5.859 Initial atlas bitmap size is 8192
   5.875 Created atlas bitmap 8192x8190
   5.876 Created atlas bitmap 8192x7002
  11.858 Factorio initialised
  16.359 Info Scenario.cpp:123: Map version 0.12.12-0
terminate called after throwing an instance of 'lua_longjmp*'
terminate called recursively
Factorio crashed. Generating symbolized stacktrace, please wait ...
#0  0x7fab3bb4b180 in ?? at ??:0
#1  0x7fab3bb4b107 in ?? at ??:0
#2  0x7fab3bb4c4e8 in ?? at ??:0
#3  0xd448dd in __gnu_cxx::__verbose_terminate_handler() at ??:?
  16.432 Error Util.cpp:61: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
Attachments
pcall-test_0.0.2.zip
(715 Bytes) Downloaded 138 times

gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Re: 0.12.12: pcall behavior changed

Post by gheift »

Rseding91 wrote:Edit: from what you've posted that's not the correct syntax for pcall: http://www.lua.org/pil/8.4.html
I just copy/pasted the call from deflatelua, but it is indeed correct syntax: http://www.lua.org/manual/5.1/manual.html#pdf-pcall

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.12.12] pcall behavior changed

Post by Oxyd »

Can't reproduce – I can start a new game with your testcase mod just fine. Can you download a fresh zip of 0.12.12 and test it with that? I suspect the updater might have broken something for you.

gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Re: [0.12.12] pcall behavior changed

Post by gheift »

This is a fresh downloaded factorio:

Code: Select all

sha512sum bin/x64/factorio 
7a4f195c3a33edd3191622ba5e4233148170830f51244cd5d00138ed1c5c66e04b81e3f0790b3f06914ed43ae2264315b81359103faa580f929ab72feeecf343  bin/x64/factorio
Here is a backtrace of pcall-test_0.0.2

Code: Select all

terminate called after throwing an instance of 'lua_longjmp*'
terminate called recursively

Program received signal SIGABRT, Aborted.
0x00007ffff602d107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff602d107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff602e4e8 in __GI_abort () at abort.c:89
#2  0x0000000000d448dd in __gnu_cxx::__verbose_terminate_handler() ()
#3  0x00007ffff7fcd830 in ?? ()
#4  0x00007ffff7fcd830 in ?? ()
#5  0x000000000b9cba20 in ?? ()
#6  0x0000000000fec200 in ?? ()
#7  0x0000000002d72680 in ?? ()
#8  0x0000000000cb7ae6 in __cxxabiv1::__terminate(void (*)()) ()
#9  0x000000000b9bb930 in ?? ()
#10 0x0000000000cb7b31 in std::terminate() ()
#11 0x000000000b9cba20 in ?? ()
#12 0x0000000000cb9956 in __cxa_rethrow ()
#13 0x0000000000e5e6a0 in typeinfo for lua_longjmp ()
#14 0x0000000000d448a1 in __gnu_cxx::__verbose_terminate_handler() ()
#15 0x0000000000cb9860 in ?? ()
#16 0x0000000000cb9860 in ?? ()
#17 0x000000000b9cba20 in ?? ()
#18 0x0000000000000000 in ?? ()
dynamic linked libraries:

Code: Select all

ldd bin/x64/factorio 
	linux-vdso.so.1 (0x00007ffd761ee000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9770648000)
	libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007f977034d000)
	libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f9770009000)
	libXcursor.so.1 => /usr/lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007f976fdfe000)
	libXinerama.so.1 => /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007f976fbfb000)
	libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007f976f9ef000)
	libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f976f7df000)
	libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x00007f976f547000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f976f33e000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f976f03d000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f976ee27000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f976ea7d000)
	/lib64/ld-linux-x86-64.so.2 (0x000055ded618a000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f976e879000)
	libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f976e657000)
	libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f976e44c000)
	libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f976e246000)
	libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f976e034000)
	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f976de0a000)
	libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f976dbdc000)
	libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f976d9d9000)
	libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f976d7d6000)
	libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f976d5bd000)
	libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f976d3b8000)
	libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f976d1b4000)
	libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f976cfb1000)
	libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f976cdaa000)
	libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f976cba6000)
	libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f976c9a0000)
	libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f976c792000)
	libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f976c58d000)
	libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f976c387000)

gheift
Fast Inserter
Fast Inserter
Posts: 188
Joined: Tue Mar 03, 2015 9:20 pm
Contact:

Re: [0.12.12] pcall behavior changed

Post by gheift »

I uploaded a core dump: https://gigamove.rz.rwth-aachen.de/down ... X2YDeo2eXc. Write me a PM for the password.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: [0.12.12] pcall behavior changed

Post by Adil »

Pardon me my intrusion into this technically elevated talk, but is pcall supposed to crash because of this:

Code: Select all

/c pcall(true)
?
This only happens on 0.12.12 (both fresh download and update)
crashlog
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13223
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.12] pcall behavior changed

Post by Rseding91 »

There's definitely something wrong with the Linux release build. We're looking into it.

This particular issue doesn't happen on the Windows release build (which is what I've been testing with).
If you want to get ahold of me I'm almost always on Discord.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.12.12] pcall behavior changed

Post by orzelek »

Rseding91 wrote:There's definitely something wrong with the Linux release build. We're looking into it.

This particular issue doesn't happen on the Windows release build (which is what I've been testing with).
Might be unrelated - I got an error posted for RSO when one of files fails to parse.
I can't reproduce it on my windows machine but there was some strange part in there (value was written as 0,4 not 0.4).
Is it possible it's related to this?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13223
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.12] pcall behavior changed

Post by Rseding91 »

orzelek wrote:
Rseding91 wrote:There's definitely something wrong with the Linux release build. We're looking into it.

This particular issue doesn't happen on the Windows release build (which is what I've been testing with).
Might be unrelated - I got an error posted for RSO when one of files fails to parse.
I can't reproduce it on my windows machine but there was some strange part in there (value was written as 0,4 not 0.4).
Is it possible it's related to this?
Yes. What would normally give a nice "script error" output and exit to the main menu is causing a full crash on the Linux release build.
If you want to get ahold of me I'm almost always on Discord.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.12.12] pcall behavior changed

Post by orzelek »

Rseding91 wrote:
orzelek wrote:
Rseding91 wrote:There's definitely something wrong with the Linux release build. We're looking into it.

This particular issue doesn't happen on the Windows release build (which is what I've been testing with).
Might be unrelated - I got an error posted for RSO when one of files fails to parse.
I can't reproduce it on my windows machine but there was some strange part in there (value was written as 0,4 not 0.4).
Is it possible it's related to this?
Yes. What would normally give a nice "script error" output and exit to the main menu is causing a full crash on the Linux release build.
It's a bit different here. It doesn't error out at all on windows build. It was parsing till now without any errors at all. And it still is for windows build.
It produced syntax error on linux(my assumption) thats visible here:
https://forums.factorio.com/forum/vie ... 94#p113909
As far as I can see that code was there from August.

User avatar
cube
Former Staff
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

Re: [0.12.12] [cube] pcall behavior changed

Post by cube »

Thanks for the report (and all the ones I marked as duplicate :-) ), these problems should be fixed for 0.12.13.

I changed our build to use link time optimizations, but it looks that the toolchain still has some bugs :-). In this case it caused the 0.12.12 to immediately terminate after an exception was thrown instead of catching it properly.

Post Reply

Return to “Resolved Problems and Bugs”