Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another small pitfall for the docs - GSlice memory error #213

Open
docb opened this issue Sep 22, 2020 · 8 comments
Open

Another small pitfall for the docs - GSlice memory error #213

docb opened this issue Sep 22, 2020 · 8 comments
Labels

Comments

@docb
Copy link

docb commented Sep 22, 2020

hi,
in my node-gdk app i got frequently
MEMORY-ERROR: node[112483]: GSlice: assertion failed: sinfo->n_allocated > 0
Aborted (core dumped)

Solution (due to some posts and it does so far not occur anymore):

G_SLICE=always-malloc node index.js

best, christian

@romgrk
Copy link
Owner

romgrk commented Sep 26, 2020

That's an interesting one. I'd rather try to understand and fix it first, if there is a technical reason for why it can't be fixed I'll include a mention in the pitfalls section. Would you be willing to help me by giving more info on how to reproduce the bug with a minimal test case? If for some reason your test case is big, would you be able to run your application with gdb -ex run --args node ./your-file.js, and get a backtrace (by typing backtrace) when there is a segfault?

@docb
Copy link
Author

docb commented Sep 26, 2020

yes sure it is better to fix it. i was not sure if it is a glib/gtk problem.
These errors occur sporadically - i cannot narrow down to actions or node js code.
here is a backtrace
Thread 1 "node" received signal SIGSEGV, Segmentation fault.
0x00007fffdf8797f3 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
(gdb) backtrace
#0 0x00007fffdf8797f3 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#1 0x00007fffdf879e36 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007fffdf87b013 in g_slice_free1 () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007fffd388c0d5 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#4 0x00007fffdfb3cfa3 in g_object_unref () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5 0x00007fffd387b12d in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#6 0x00007fffdf84b022 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#7 0x00007fffdf84b98f in g_hash_table_unref () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#8 0x00007fffd387b13b in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#9 0x00007fffd3878f1c in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#10 0x00007fffd3879cc5 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#12 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#13 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#14 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#15 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#16 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#17 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#18 0x00007fffd38608c6 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#19 0x00007fffdfb3810d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007fffdfb4b05e in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007fffdfb53715 in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007fffdfb5412f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007fffda89aa22 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#24 0x00007fffda886080 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#25 0x00007fffdf85dd03 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007fffdf85d285 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007fffdf85d650 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007fffdf85d962 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007fffd3927a25 in gtk_main () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#30 0x00007fffded4edae in ffi_call_unix64 () at /usr/lib/x86_64-linux-gnu/libffi.so.6
#31 0x00007fffded4e71f in ffi_call () at /usr/lib/x86_64-linux-gnu/libffi.so.6
#32 0x00007fffdfda5382 in GNodeJS::FunctionCall(GNodeJS::FunctionInfo*, Nan::FunctionCallbackInfov8::Value const&, _GIArgument*, _GError**) (func=0x2ed8ee0, info=..., return_value=return_value@entry=0x0, error=error@entry=0x0) at ../src/function.cc:258
#33 0x00007fffdfda5824 in GNodeJS::FunctionInvoker(Nan::FunctionCallbackInfov8::Value const&) (info=...) at ../src/function.cc:638
#34 0x00007fffdfda3aef in Nan::imp::FunctionCallbackWrapper(v8::FunctionCallbackInfov8::Value const&) (info=...) at ../node_modules/nan/nan_callbacks_12_inl.h:176
#35 0x0000000000b917ef in v8::internal::MaybeHandlev8::internal::Object v8::internal::(anonymous namespace)::HandleApiCallHelper(v8::internal::Isolate*, v8::internal::Handlev8::internal::HeapObject, v8::internal::Handlev8::internal::HeapObject, v8::internal::Handlev8::internal::FunctionTemplateInfo, v8::internal::Handlev8::internal::Object, v8::internal::BuiltinArguments) ()
#36 0x0000000000b92359 in v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) ()
#37 0x00000c4a291dbe1d in ()
#38 0x00000c4a291dbd81 in ()
#39 0x00007fffffffb8d0 in ()
#40 0x0000000000000006 in ()
#41 0x00007fffffffb960 in ()
#42 0x00000c4a291918d5 in ()
#43 0x00001a1c920026f1 in ()

@docb
Copy link
Author

docb commented Sep 26, 2020

here is one with the GSlice Error
MEMORY-ERROR: node[40442]: GSlice: assertion failed: sinfo->n_allocated > 0

Thread 1 "node" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) backtrace
#0 0x00007ffff6ab8f47 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff6aba8b1 in __GI_abort () at abort.c:79
#2 0x00007fffdf879724 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007fffdf879794 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007fffdf879e36 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x00007fffdf87b013 in g_slice_free1 () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#6 0x00007fffd388c0d5 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#7 0x00007fffdfb3cfa3 in g_object_unref () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#8 0x00007fffd3862dbd in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#9 0x00007fffdfb3d012 in g_object_unref () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007fffd388596c in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x00007fffd38943f2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#12 0x00007fffd3879c7b in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#13 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#14 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#15 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#16 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#17 0x00007fffd3879cdb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#18 0x00007fffd38608c6 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#19 0x00007fffdfb3810d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007fffdfb4b05e in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007fffdfb53715 in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007fffdfb5412f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007fffda8e1a22 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#24 0x00007fffda8cd080 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#25 0x00007fffdf85dd03 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007fffdf85d285 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007fffdf85d650 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007fffdf85d962 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007fffd3927a25 in gtk_main () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#30 0x00007fffded4edae in ffi_call_unix64 () at /usr/lib/x86_64-linux-gnu/libffi.so.6
#31 0x00007fffded4e71f in ffi_call () at /usr/lib/x86_64-linux-gnu/libffi.so.6
#32 0x00007fffdfda5382 in GNodeJS::FunctionCall(GNodeJS::FunctionInfo*, Nan::FunctionCallbackInfov8::Value const&, _GIArgument*, _GError**) (func=0x2ed4680, info=..., return_value=return_value@entry=0x0, error=error@entry=0x0) at ../src/function.cc:258
#33 0x00007fffdfda5824 in GNodeJS::FunctionInvoker(Nan::FunctionCallbackInfov8::Value const&) (info=...) at ../src/function.cc:638
#34 0x00007fffdfda3aef in Nan::imp::FunctionCallbackWrapper(v8::FunctionCallbackInfov8::Value const&) (info=...) at ../node_modules/nan/nan_callbacks_12_inl.h:176
#35 0x0000000000b917ef in v8::internal::MaybeHandlev8::internal::Object v8::internal::(anonymous namespace)::HandleApiCallHelper(v8::internal::Isolate*, v8::internal::Handlev8::internal::HeapObject, v8::internal::Handlev8::internal::HeapObject, v8::internal::Handlev8::internal::FunctionTemplateInfo, v8::internal::Handlev8::internal::Object, v8::internal::BuiltinArguments) ()
#36 0x0000000000b92359 in v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) ()
#37 0x00002b78b99dbe1d in ()
#38 0x00002b78b99dbd81 in ()
#39 0x00007fffffffb8d0 in ()
#40 0x0000000000000006 in ()
#41 0x00007fffffffb960 in ()

@docb
Copy link
Author

docb commented Sep 28, 2020

it happens when the mouse pointer leaves the window. may be not all cases but this i could observe multiple times.

@docb
Copy link
Author

docb commented Sep 28, 2020

another observation: with G_SLICE=always-malloc set i have no sudden crashes anymore but suddenly the motion event frequency goes down to c.a 3 events per second which is either unusable. however so far i cannot see any leaks in the system monitor.

@romgrk
Copy link
Owner

romgrk commented Oct 9, 2020

Got it. Do you happen to have a reproducible example? If your code is in a public repo I'd be happy to test it.

@docb
Copy link
Author

docb commented Oct 9, 2020

https://github.com/docb/gtkosc
i have pushed this one. call node index.js and play arround.

@romgrk
Copy link
Owner

romgrk commented Oct 17, 2020

Got it. I've been able to reproduce quite quickly, I'll investigate.

@romgrk romgrk added the bug label Oct 26, 2020
@romgrk romgrk mentioned this issue Dec 18, 2020
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants