I have a Freebsd machine running Cuberite
It runs fine without major problems
but I am stuck making Lua plugins because using ForEachEntity function and relavant callbackfunction gives me segfault error
Please help me
function GetIf(Name)
-- Check if unique mob matching name exist
cRoot:Get():ForEachWorld(
function (w)
LOG("fetching from " .. w:GetName())
w:ForEachEntity(
function (e)
if not(e:IsMob()) then
return true
else
return true
end
end
)
end
)
end
Hello,
that is weird. Are you running a precompiled binary downloaded from our buildservers, or are you compiling yourself? Would you be willing to compile a debug version and run it under a debugger to see the exact stacktrace?
(04-06-2017, 05:41 PM)xoft Wrote: [ -> ]Hello,
that is weird. Are you running a precompiled binary downloaded from our buildservers, or are you compiling yourself? Would you be willing to compile a debug version and run it under a debugger to see the exact stacktrace?
Thank you for your fast reply,
I am running precompiled version and also tried self-compile version which led to same result
(Independant Lua included with source files is compiled)
I'd really like to help you because I myself am a C programmer and like C projects
Can you direct me how to install debug version?
I will post stacktrace when I come from work
FYI : other ForEach functions work properly
(04-06-2017, 05:41 PM)xoft Wrote: [ -> ]Hello,
that is weird. Are you running a precompiled binary downloaded from our buildservers, or are you compiling yourself? Would you be willing to compile a debug version and run it under a debugger to see the exact stacktrace?
attached gdb crash log tho not sure I am doing right because it's my first time using gdb :P
Code:
Currently logging to "crash.txt".
Logs will be appended to the log file.
Output will be logged and displayed.
Starting program: /media/8958d333-cf1f-11e6-8b39-6c626d3e9b63/Cub/cuberite/Server/Cuberite_debug
[New LWP 100196]
[New Thread 802c16000 (LWP 100196/Cuberite_debug)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 802c16000 (LWP 100196/Cuberite_debug)]
0x00000008020ebdf4 in pthread_mutex_destroy () from /lib/libthr.so.3
[New Thread 802c16500 (LWP 100197/Cuberite_debug)]
3 Thread 802c16500 (LWP 100197/Cuberite_debug) 0x000000080244498a in _kevent
() from /lib/libc.so.7
* 2 Thread 802c16000 (LWP 100196/Cuberite_debug) 0x00000008020ebdf4 in pthread_mutex_destroy () from /lib/libthr.so.3
Thread 3 (Thread 802c16500 (LWP 100197/Cuberite_debug)):
#0 0x000000080244498a in _kevent () from /lib/libc.so.7
#1 0x00000008020e7b82 in pthread_suspend_all_np () from /lib/libthr.so.3
#2 0x0000000000d73eb0 in kq_dispatch (base=0x802c2e000, tv=0x0)
at /media/8958d333-cf1f-11e6-8b39-6c626d3e9b63/Cub/cuberite/lib/libevent/kqueue.c:302
#3 0x0000000000d5dece in event_base_loop (base=0x802c2e000, flags=4)
at /media/8958d333-cf1f-11e6-8b39-6c626d3e9b63/Cub/cuberite/lib/libevent/event.c:1943
#4 0x000000000068de0f in cNetworkSingleton::RunEventLoop (a_Self=0x11a2030)
at /media/8958d333-cf1f-11e6-8b39-6c626d3e9b63/Cub/cuberite/src/OSSupport/NetworkSingleton.cpp:174
#5 0x0000000000691e25 in _ZNSt3__114__thread_proxyINS_5tupleIJPFvP17cNetworkSingletonES3_EEEEEPvS7_ (__vp=0x802c36010) at __functional_base:365
#6 0x00000008020e4b55 in pthread_create () from /lib/libthr.so.3
#7 0x0000000000000000 in ?? ()
Thread 2 (Thread 802c16000 (LWP 100196/Cuberite_debug)):
#0 0x00000008020ebdf4 in pthread_mutex_destroy () from /lib/libthr.so.3
#1 0x00000008020eb506 in pthread_mutex_lock () from /lib/libthr.so.3
#2 0x0000000801a79b39 in std::__1::recursive_mutex::lock ()
from /usr/lib/libc+Quit
The program is running. Exit anyway? (y or n)
I guess this issue is related to Freebsd POSIX multithread library...
When is the code called? On startup from server or from command handler, hook or etc.
I added the code to the Initialize of a plugin and Cuberite crashes every time on startup. Your stack trace is nearly the same like on my side.
Plugins are initialized, before the worlds are loaded. The crash is still a problem, but for now it should work running the code, when the worlds have been loaded. For example from command handler or a hook.
(04-07-2017, 02:39 AM)Seadragon91 Wrote: [ -> ]When is the code called? On startup from server or from command handler, hook or etc.
At server startup
It's really weird because the plugin does not produce segfault when it's reloaded and fired
Thank you for looking into the log
(04-07-2017, 02:59 AM)Seadragon91 Wrote: [ -> ]I added the code to the Initialize of a plugin and Cuberite crashes every time on startup. Your stack trace is nearly the same like on my side.
Plugins are initialized, before the worlds are loaded. The crash is still a problem, but for now it should work running the code, when the worlds have been loaded. For example from command handler or a hook.
I will give it a try, thank you
