HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. "Read more...":https://support.plan.io/news/187
Bug #880869
closedSome bug with tolua-5.2 garbage collecting Direction objects
0%
Description
To reproduce, just type consequently in client Lua console, replace 154 on any visible unit id:
c = find.unit(nil,154) d= c:facing() c=nil d=nil collectgarbage()
If you collect only the unit, there is no failure, but the queer Direction object fails the client.
Backtrace shows calling NULL in such a stack:
(gdb) backtrace #0 0x0000000000000000 in () #1 0x0000555555696f57 in luaD_precall (L=L@entry=0x555555b310a8, func=0x555556d0c1b0, nresults=0) at ldo.c:434 ... #5 0x00005555556aa401 in class_gc_event (L=0x555555b310a8) at tolua_event.c:392 ... (gdb) print func $1 = (StkId) 0x555556d0c1b0 (gdb) print *func $2 = {value_ = {gc = 0x0, p = 0x0, b = 0, f = 0x0, i = 0, n = 0}, tt_ = 22}
Files
Related issues
Updated by Marko Lindqvist over 2 years ago
- Related to Bug #688119: Intermittent segfault invoking Lua direction functions added
Updated by Alexandro Ignatiev over 2 years ago
It's a tolua problem with returning user types in C projects: it does not supply any garbagecollector but tries to call it. I've made a patch that uses my own collector. It's still a question if we really need to put 4-bit enum into a dynamically allocated object but this patch keeps current behaviour produces objects as it's done now for valid directions and returns nil for invalid ones, but currently direction.next_ccw(direction.str2dir("somewhere"))
just hangs the application and it's a bad idea to turn units into invalid directions, so I think nothing meaningful is harmed.
Updated by Alexandro Ignatiev over 2 years ago
Well, this is shooting a cannon at sparrows, also, still eats up memory. Let's remember this way for some better task like creating virtual units (or just fix a couple of lines in tolua code) and now put a more adequate solution with returning all directions from a static array.
EDIT: testing found abnormal jumping between "const Direction" and "Direction" classes, something wrong...
Updated by Alexandro Ignatiev over 2 years ago
All what was needed is just removing const
's from tolua functions. This tolua version does not interest const
function modifiers except giving different methods (needs clarification but you understand how const objects can be violated...) Now it does not segfault on gc.
Updated by Alexandro Ignatiev over 2 years ago
- Blocks Bug #880895: Global variables with directions result in broken savegames added
Updated by Alexandro Ignatiev over 2 years ago
Finally, I made the patch working with mainstream S2_6 branch and put it on the right ticket %\
Updated by Marko Lindqvist over 2 years ago
- Related to deleted (Bug #688119: Intermittent segfault invoking Lua direction functions)
Updated by Marko Lindqvist over 2 years ago
- Has duplicate Bug #688119: Intermittent segfault invoking Lua direction functions added
Updated by Marko Lindqvist over 2 years ago
- File 0016-Scripting-Fix-segfaults-with-Direction-objects.patch 0016-Scripting-Fix-segfaults-with-Direction-objects.patch added
- Category set to Scripting API
- Status changed from New to Resolved
- Assignee set to Marko Lindqvist
Ported to master.
Updated by Marko Lindqvist over 2 years ago
- Status changed from Resolved to Closed
Updated by Marko Lindqvist over 2 years ago
- Sprint/Milestone changed from 2.6.3 to 2.6.2.1