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

Fix segfault crash in easy_thresh.py #62

Open
kev-the-dev opened this issue May 25, 2017 · 3 comments
Open

Fix segfault crash in easy_thresh.py #62

kev-the-dev opened this issue May 25, 2017 · 3 comments

Comments

@kev-the-dev
Copy link
Contributor

kev-the-dev commented May 25, 2017

There's a really nice python tool called easy_thresh we ported from Subjugator. It seems to be broken on ros kinetic / 16.04. It still runs fine on my 14.04/Indigo system. After selecting a region to threshold, the 3D plot of the colors in this region opens briefly, then crashes, with a segmentation fault being reported in the terminal that opened it and no other errors. I tried my hand at fixing it, but it uses several libraries I have no experience with. Does anyone know who originally wrote this?

@mattlangford
Copy link
Member

mattlangford commented May 26, 2017

@jpanikulam wrote it, can you post the output leading up to the crash (maybe add some extra prints)?

Did you play around with the opencv stuff? If that's not broken it could be change in the sklearn version that breaks KMeans?

@kev-the-dev
Copy link
Contributor Author

Here's all the output I get:

Using HSV instead of bgr
getting topic /stereo/right/image_rect_color
Got image
init done
click
click
click
click
done
finished
done clustering
1

(easy_thresh.py:22726): Gdk-WARNING **: /build/gtk+2.0-KsZKkB/gtk+2.0-2.24.30/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window

(easy_thresh.py:22726): Gdk-WARNING **: /build/gtk+2.0-KsZKkB/gtk+2.0-2.24.30/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window

(easy_thresh.py:22726): Gdk-WARNING **: /build/gtk+2.0-KsZKkB/gtk+2.0-2.24.30/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window

(easy_thresh.py:22726): Gdk-WARNING **: /build/gtk+2.0-KsZKkB/gtk+2.0-2.24.30/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window

(easy_thresh.py:22726): Gdk-WARNING **: /build/gtk+2.0-KsZKkB/gtk+2.0-2.24.30/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window

(easy_thresh.py:22726): Gdk-WARNING **: /build/gtk+2.0-KsZKkB/gtk+2.0-2.24.30/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window

(easy_thresh.py:22726): Gdk-WARNING **: /build/gtk+2.0-KsZKkB/gtk+2.0-2.24.30/gdk/x11/gdkdrawable-x11.c:952 drawable is not a pixmap or window
2
Segmentation fault (core dumped)

It crashes in a cv2.waitKey loop to keep the program alive so you can move around the visual threshold. Maybe it is OpenCV and some other GUI library conflicting? Some wacky threading stuff going on... Here's the backtrace I get

Thread 1 "python" received signal SIGSEGV, Segmentation fault.
__GI___pthread_mutex_lock (mutex=0x0) at ../nptl/pthread_mutex_lock.c:67
67	../nptl/pthread_mutex_lock.c: No such file or directory.
(gdb) backtrace
#0  __GI___pthread_mutex_lock (mutex=0x0) at ../nptl/pthread_mutex_lock.c:67
#1  0x00007fffeea6abfa in XrmQGetResource () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#2  0x00007fffeea46f86 in XGetDefault () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#3  0x00007fffee39593f in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
#4  0x00007fffee397e60 in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
#5  0x00007fffee369627 in cairo_surface_get_font_options ()
   from /usr/lib/x86_64-linux-gnu/libcairo.so.2
#6  0x00007fffee327cff in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
#7  0x00007fffee32ae13 in ?? () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
#8  0x00007fffee31ca44 in cairo_show_glyphs () from /usr/lib/x86_64-linux-gnu/libcairo.so.2
#9  0x00007fffee61822b in ?? () from /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0
#10 0x00007fffee6185bf in ?? () from /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0
#11 0x00007fffef2eac79 in pango_renderer_draw_glyphs ()
   from /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0
#12 0x00007fffef2eb930 in pango_renderer_draw_layout_line ()
   from /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0
#13 0x00007fffef2ebb45 in pango_renderer_draw_layout ()
   from /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0
#14 0x00007fffee61876a in ?? () from /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0
#15 0x00007fffefaa72a0 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#16 0x00007fffefaa8a69 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#17 0x00007fffefb18afc in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#18 0x00007fffef07ffa5 in g_closure_invoke ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#19 0x00007fffef09256e in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007fffef09a7f9 in g_signal_emit_valist ()
   from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007fffef09b08f in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007fffefc308cc in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#23 0x00007fffefb178b2 in gtk_main_do_event ()
   from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#24 0x00007fffef772b9f in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#25 0x00007fffef772b45 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#26 0x00007fffef772b45 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#27 0x00007fffef772b45 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#28 0x00007fffef772b45 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#29 0x00007fffef772b45 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#30 0x00007fffef76f671 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#31 0x00007fffef77013d in gdk_window_process_updates ()
   from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#32 0x00007fffefb57fe6 in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#33 0x00007fffef74ed57 in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#34 0x00007fffeeda9ab3 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007fffeeda904a in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007fffeeda93f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007fffeeda949c in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007fff9663c7cf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#39 0x00007fff8c683d1f in cvWaitKey () from /opt/ros/kinetic/lib/libopencv_highgui3.so.3.2
#40 0x00007fff8c6811a6 in cv::waitKey(int) ()
   from /opt/ros/kinetic/lib/libopencv_highgui3.so.3.2
#41 0x00007fff908e8f38 in ?? () from /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so
#42 0x00000000004c468a in call_function (oparg=<optimized out>, pp_stack=0x7fffffffd910)
    at ../Python/ceval.c:4350
---Type <return> to continue, or q <return> to quit---
#43 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
#44 0x00000000004c2765 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#45 0x00000000004c2509 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, 
    locals=<optimized out>) at ../Python/ceval.c:669
#46 0x00000000004f1def in run_mod.lto_priv () at ../Python/pythonrun.c:1376
#47 0x00000000004ec652 in PyRun_FileExFlags () at ../Python/pythonrun.c:1362
#48 0x00000000004eae31 in PyRun_SimpleFileExFlags () at ../Python/pythonrun.c:948
#49 0x000000000049e14a in Py_Main () at ../Modules/main.c:640
#50 0x00007ffff7811830 in __libc_start_main (main=0x49dab0 <main>, argc=4, 
    argv=0x7fffffffdd58, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffdd48) at ../csu/libc-start.c:291
#51 0x000000000049d9d9 in _start ()

@mattlangford
Copy link
Member

I think you're right, have you looked at the file (https://github.com/uf-mil/SubjuGator/blob/master/perception/sub8_perception/sub8_vision_tools/visual_threshold_tools.py), this script makes calls there and it does GUI stuff. I've never touched that file or library so I can't help much there. Side note, that visual threshold tool file should prolly be moved into mil common

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants