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

SIGSEGV with max_width/height > 0 with AUR version and no result at all with Git Build #84

Closed
DLFW opened this issue Jul 7, 2023 · 12 comments

Comments

@DLFW
Copy link

DLFW commented Jul 7, 2023

Hi!
I'm trying to get ueberzugpp to work on X11. I'm using the Kitty terminal.

I'm on arch and I tried ueberzugpp installed from the AUR and a build from Git master (d4c3a57). Both variants don't succeed but yield different behavior.

After I had installed the AUR version, I had to additionally install the packages opencv and openslide to get rid of error messages. I built the version from Git after I installed those packages. Maybe that influences the different behavior.

Given max_height and max_width > 0, AUR version SIGSEGVs 🧨

Terminal 1

export SPDLOG_LEVEL=debug
mkfifo foo
ueberzugpp layer < foo &

Terminal 2

echo '{"action":"add","identifier":"preview","max_height":2,"max_width":2,"path":"/home/daniel/.cache/thumbnails/x-large/dfa14ef23d0f44c03fffcb25a4f98358.png","x":0,"y":0}' > foo

The image is a RGBA PNG with 8 bit per channel. Nothing special.

Result with AUR version

The AUR-installed version terminates by signal SIGSEGV`.
The log file does not show anything that looks suspicious to me:

[2023-07-07 22:51:30.123] [opencv] [info] Loading image /home/daniel/.cache/thumbnails/x-large/dfa14ef23d0f44c03fffcb25a4f98358.png
[2023-07-07 22:51:30.125] [X11] [debug] Initializing canvas
[2023-07-07 22:51:30.125] [X11] [debug] Created child window 44040196 at (0,0) with parent 41943054
[2023-07-07 22:51:30.125] [X11] [debug] Received expose event for window 44040196
[2023-07-07 22:51:30.125] [X11] [debug] Received expose event for window 44040196
[2023-07-07 22:51:38.521] [main] [info] Command received: {"action":"remove","identifier":"preview"}
[2023-07-07 22:51:38.521] [main] [info] Removing image.
[2023-07-07 22:51:54.854] [main] [info] Command received: {"action":"add","identifier":"preview","max_height":2,"max_width":2,"path":"/home/daniel/.cache/thumbnails/x-large/dfa14ef23d0f44c03fffcb25a4f98358.png","x":0,"y":0}
[2023-07-07 22:51:54.859] [opencv] [info] Loading image /home/daniel/.cache/thumbnails/x-large/dfa14ef23d0f44c03fffcb25a4f98358.png

Given max_height == max_width == 0, AUR version works 👍

With the same as above but feeding ueberzugpp with max_height = 0 and max_width = 0, it works with both, the X11 and the kitty output option.

Build from Repo is moody 🤢

In both test-cases from above, the build from master just does nothing. Really nothing. Sometimes, it just seems to freeze. Very strange. Killing ueberzugpp and tail does not help. I have to kill the terminal.

The logs nicely tells me that ueberzugpp receives my SIGINT, but it seems not care about it...

                                       |___/     v2.8.8
[2023-07-07 22:57:48.130] [terminal] [info] TERM="xterm-kitty", TERM_PROGRAM=""
[2023-07-07 22:57:48.131] [terminal] [debug] PTY = /dev/pts/5
[2023-07-07 22:57:48.131] [terminal] [debug] ioctl sizes: COLS=141 ROWS=35 XPIXEL=1269 YPIXEL=700
[2023-07-07 22:57:48.131] [terminal] [debug] iterm2 is not supported
[2023-07-07 22:57:48.131] [terminal] [debug] X11 is supported
[2023-07-07 22:57:48.131] [terminal] [debug] X11 sizes: XPIXEL=1269 YPIXEL=700
[2023-07-07 22:57:48.131] [terminal] [debug] padding_horiz=0 padding_vert=0
[2023-07-07 22:57:48.131] [terminal] [debug] font_width=9 font_height=20
[2023-07-07 22:57:48.131] [main] [debug] Wayland support not compiled in the binary
[2023-07-07 22:57:48.131] [X11] [info] Canvas created
[2023-07-07 22:57:48.131] [X11] [debug] Started event handler
[2023-07-07 22:57:48.131] [main] [info] Listening for commands on socket /tmp/ueberzugpp-25371.socket.
[2023-07-07 22:57:51.649] [main] [info] Command received: {"action":"add","identifier":"preview","max_height":2,"max_width":2,"path":"/home/daniel/.cache/thumbnails/x-large/dfa14ef23d0f44c03fffcb25a4f98358.png","x":0,"y":0}
[2023-07-07 22:57:51.656] [opencv] [info] Loading image /home/daniel/.cache/thumbnails/x-large/dfa14ef23d0f44c03fffcb25a4f98358.png
[2023-07-07 23:00:52.744] [X11] [debug] Received unknown event 34
[2023-07-07 23:00:52.744] [X11] [debug] Received unknown event 34
[2023-07-07 23:01:09.696] [X11] [debug] Received unknown event 34
[2023-07-07 23:01:09.697] [X11] [debug] Received unknown event 34
[2023-07-07 23:05:51.357] [main] [error] SIGINT received, exiting.
[2023-07-07 23:05:51.365] [X11] [debug] Stopped event handler
[2023-07-07 23:05:53.125] [main] [error] SIGINT received, exiting.
[2023-07-07 23:05:53.333] [main] [error] SIGINT received, exiting.
... Can go on forever....

Bad luck with the versions I use?

@DLFW DLFW changed the title SIGSEGV with max_width/height > 0 with AUR version and not result at all with Git Build SIGSEGV with max_width/height > 0 with AUR version and no result at all with Git Build Jul 7, 2023
@jstkdng
Copy link
Owner

jstkdng commented Jul 7, 2023

hey, thanks for reporting. Maybe the image you are trying to use doesn't work with opencv. Add the --no-opencv flag and test if that works.

@DLFW
Copy link
Author

DLFW commented Jul 8, 2023

Ok, tried it with -no-opencv:

AUR installed version

Now I get this error instead:

❯ vips_image_dispose: temp-12 vips_reduceh_gen computed 200%
vips_image_dispose: temp-13 vips_shrinkh_gen computed 200%
vips_image_dispose: temp-8 vips_shrinkv_gen computed 885%
vips_image_dispose: temp-11 vips_reducev_vector_gen computed 200%
memory: high-water mark 1.02 MB
error buffer: vips_image_get: field "n-pages" not found

fish: Job 1, 'ueberzugpp layer --no-opencv < …' has ended

Build from Git master

Still just does nothing. And it does not write anything to the log-file either.

@DLFW
Copy link
Author

DLFW commented Jul 8, 2023

Hm, I will forget about my build that I did from Git master. There must be something basic broken.

However, with the AUR-version, I tried it again the "socket way"; and it's just the same behavior. It works without max-width and max-height, but not with of them, I get

terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
fish: Job 1, 'ueberzugpp cmd -s "$UB_SOCKET" …' terminated by signal SIGABRT (Abbruch)

I think that error msg is just because the target-instance of ueberzugpp died. At least I get the same message with any invalid socket. That error msg could be enhanced, btw.

I also tried the scripts/img script.

Works:

./img 3 3 0 0 someimage.jpg

Does not work:

./img 3 3 10 10 ~/sandbox/wallpapers/abstract/Abstract0006.jpg

If only one dimension is set to a value > 0, the image is shown but not scaled down into the bounding box.

@jstkdng
Copy link
Owner

jstkdng commented Jul 8, 2023

it's fine, use the master version and be sure to make a debug compilation. Once you have this, trigger the segfault and then run coredumpctl -1 debug. Once you have the gdb prompt, write bt and post the result here.

@DLFW
Copy link
Author

DLFW commented Jul 8, 2023

Again with the img script:

❯ coredumpctl -1 debug
           PID: 6746 (ueberzugpp)
           UID: 1000 (daniel)
           GID: 985 (users)
        Signal: 11 (SEGV)
     Timestamp: Sat 2023-07-08 20:46:28 CEST (10min ago)
  Command Line: ueberzugpp layer --no-stdin --pid-file /tmp/.949f9be8-ed0e-4a61-906a-1e71bdfc3b78
    Executable: /usr/bin/ueberzug
 Control Group: /user.slice/user-1000.slice/session-1.scope
          Unit: session-1.scope
         Slice: user-1000.slice
       Session: 1
     Owner UID: 1000 (daniel)
       Boot ID: fc6c899bf5504321a645b15888de2f60
    Machine ID: f7411fd556244357b81f22e9a7300a2e
      Hostname: athene
       Storage: /var/lib/systemd/coredump/core.ueberzugpp.1000.fc6c899bf5504321a645b15888de2f60.6746.1688841988000000.zst (present)
  Size on Disk: 3.2M
       Message: Process 6746 (ueberzugpp) of user 1000 dumped core.
                
                Module libintlc.so.5 without build-id.
                Module libimf.so without build-id.
                Module libsvml.so without build-id.
                Module libOpenCL.so without build-id.
                Stack trace of thread 6748:
                #0  0x00007f89784adc5e __libc_free (libc.so.6 + 0x97c5e)
                #1  0x00007f895ee4ee04 n/a (libamdocl64.so + 0xb1e04)
                #2  0x00007f895eecdbdd n/a (libamdocl64.so + 0x130bdd)
                #3  0x00007f895ee1e45d n/a (libamdocl64.so + 0x8145d)
                #4  0x00007f89784a25bf n/a (libc.so.6 + 0x8c5bf)
                #5  0x00007f895ee1e2a0 clIcdGetPlatformIDsKHR (libamdocl64.so + 0x812a0)
                #6  0x00007f896413a809 n/a (libOpenCL.so + 0xf809)
                #7  0x00007f896413c955 clGetPlatformIDs (libOpenCL.so + 0x11955)
                #8  0x00007f897925f13f _ZN2cv3ocl10haveOpenCLEv (libopencv_core.so.407 + 0x25f13f)
                #9  0x00007f8979261d56 _ZN2cv3ocl22OpenCLExecutionContext10getCurrentEv (libopencv_core.so.407 + 0x261d56)
                #10 0x00007f89792686d0 _ZN2cv3ocl7Context10getDefaultEb (libopencv_core.so.407 + 0x2686d0)
                #11 0x000055e8955998d5 _ZN11OpencvImage12resize_imageEv (ueberzug + 0x538d5)
                #12 0x000055e89559b422 _ZN11OpencvImage13process_imageEv (ueberzug + 0x55422)
                #13 0x000055e89559bebc _ZN11OpencvImageC2ERK10DimensionsRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb (ueberzug + 0x55ebc)
                #14 0x000055e895617aa6 _ZSt11make_uniqueI11OpencvImageJRK10DimensionsRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERbEENSt8__detail9_MakeUniqIT_E15__single_objectEDpOT0_ (ueberzug + 0xd1aa6)
                #15 0x000055e8955d8d79 _ZN11Application7executeESt17basic_string_viewIcSt11char_traitsIcEE (ueberzug + 0x92d79)
                #16 0x000055e8955d9258 _ZN11Application11socket_loopEv (ueberzug + 0x93258)
                #17 0x00007f89786e1943 execute_native_thread_routine (libstdc++.so.6 + 0xe1943)
                #18 0x00007f897849d44b n/a (libc.so.6 + 0x8744b)
                #19 0x00007f8978520e40 n/a (libc.so.6 + 0x10ae40)
                
                Stack trace of thread 6747:
                #0  0x00007f8978513c0f __poll (libc.so.6 + 0xfdc0f)
                #1  0x000055e8955e5aa7 poll (ueberzug + 0x9faa7)
                #2  0x000055e895565d0a _ZN9X11Canvas13handle_eventsEv (ueberzug + 0x1fd0a)
                #3  0x000055e895566080 operator() (ueberzug + 0x20080)
                #4  0x00007f89786e1943 execute_native_thread_routine (libstdc++.so.6 + 0xe1943)
                #5  0x00007f897849d44b n/a (libc.so.6 + 0x8744b)
                #6  0x00007f8978520e40 n/a (libc.so.6 + 0x10ae40)
                
                Stack trace of thread 6746:
                #0  0x00007f8978499f0e n/a (libc.so.6 + 0x83f0e)
                #1  0x00007f897849f023 n/a (libc.so.6 + 0x89023)
                #2  0x00007f89786e19b8 __gthread_join (libstdc++.so.6 + 0xe19b8)
                #3  0x000055e8955d24ba _ZN11ApplicationD2Ev (ueberzug + 0x8c4ba)
                #4  0x000055e89555fe37 main (ueberzug + 0x19e37)
                #5  0x00007f8978439850 n/a (libc.so.6 + 0x23850)
                #6  0x00007f897843990a __libc_start_main (libc.so.6 + 0x2390a)
                #7  0x000055e8955605a5 _start (ueberzug + 0x1a5a5)
                
                Stack trace of thread 6752:
                #0  0x00007f897851576f ioctl (libc.so.6 + 0xff76f)
                #1  0x00007f896406e541 n/a (libhsakmt.so.1 + 0xc541)
                #2  0x00007f8964067fbf hsaKmtWaitOnMultipleEvents (libhsakmt.so.1 + 0x5fbf)
                #3  0x00007f895ea75b87 n/a (libhsa-runtime64.so.1 + 0x75b87)
                #4  0x00007f895ea57897 n/a (libhsa-runtime64.so.1 + 0x57897)
                #5  0x00007f895ea6934b n/a (libhsa-runtime64.so.1 + 0x6934b)
                #6  0x00007f895ea24bac n/a (libhsa-runtime64.so.1 + 0x24bac)
                #7  0x00007f897849d44b n/a (libc.so.6 + 0x8744b)
                #8  0x00007f8978520e40 n/a (libc.so.6 + 0x10ae40)
                
                Stack trace of thread 6753:
                #0  0x00007f89785195db __madvise (libc.so.6 + 0x1035db)
                #1  0x00007f897849d55a n/a (libc.so.6 + 0x8755a)
                #2  0x00007f8978520e40 n/a (libc.so.6 + 0x10ae40)
                ELF object binary architecture: AMD x86-64

I just realized that with the img script, when adding the --no-opencv switch, it seems to work. However, that script seems to "swallow" some of my last terminal lines...

@jstkdng
Copy link
Owner

jstkdng commented Jul 8, 2023

that'd only mean that opencl is not working on your system for some reason.I'd suggest to stick with libvips.

@DLFW
Copy link
Author

DLFW commented Jul 8, 2023

Hm... I actually doubt that there is a problem with my system. But let's assume there is, then I would still suggest...

  1. That überzugpp gives some proper error messages/hints instead of just dying and driving users nuts.
  2. libvips... I guess that is some alternative that is used in case there is no opencv. The readme could be a bit more enlightening here. If I use --no-opencv, überzugpp spoils my terminal with error buffer: vips_image_get: field "n-pages" not found like messages, and I need to redirect to /dev/null... also a very hacky thing that should be fixed, IMHO.

I will try the same thing on a VM at work next week. Let's see if it's reproducible on another machine.

@jstkdng
Copy link
Owner

jstkdng commented Jul 8, 2023

Those messages are there because arch's libvips package is compiled in debug mode. To get a release build install libvips-git. Installing it should clear those messages. There's also the --silent flag which is documented.

That überzugpp gives some proper error messages/hints instead of just dying and driving users nuts.

There's only so much error handling I can do, ueberzugpp just checks if opencl is available and then the ball is on opencv's court.

Can you try again to post the backtrace, but be sure to have the debug symbols installed. The aur package should have built a ueberzugpp-debug package when you built it.

@DLFW
Copy link
Author

DLFW commented Jul 10, 2023

Yup, alright, I did a new build (because of system update), and installed the debug package.

When trying first with opencv, the image was successfully shown, also with given --max-width and -height.
Then, after 3 successful images displayed, it happened again. Hope this is the stuff you wanted to see:

--Type <RET> for more, q to quit, c to continue without paging--c
[Thread debugging using libthread_db enabled]                                                                                                
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `ueberzugpp layer --no-stdin --silent --pid-file /tmp/.7e11b203-a84b-42f5-a009-4'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007ff8c28adc5e in __GI___libc_free (mem=0x1d) at malloc.c:3344
3344	 if (chunk_is_mmapped (p))                       /* release mmapped memory. */                                                      
[Current thread is 1 (Thread 0x7ff8aeffe6c0 (LWP 13134))]
(gdb) bt
#0  0x00007ff8c28adc5e in __GI___libc_free (mem=0x1d) at malloc.c:3344
#1  0x00007ff8c2aaeaba in operator delete(void*) (ptr=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/del_op.cc:49
#2  0x00007ff8c2aaeaea in operator delete[](void*) (ptr=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/del_opv.cc:35
#3  0x00007ff8ad24ee04 in roc::Device::~Device() (this=0x7ff8a8186ac0, this=<optimized out>)
    at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/device/rocm/rocdevice.cpp:260
#4  0x00007ff8ad2cdbdd in roc::Device::~Device() (this=0x7ff8a8186ac0, this=<optimized out>)
    at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/device/rocm/rocdevice.cpp:271
#5  std::default_delete<roc::Device>::operator()(roc::Device*) const (__ptr=0x7ff8a8186ac0, this=<optimized out>)
    at /usr/include/c++/12.2.1/bits/unique_ptr.h:95
#6  std::unique_ptr<roc::Device, std::default_delete<roc::Device> >::~unique_ptr() (this=<synthetic pointer>, this=<optimized out>)
    at /usr/include/c++/12.2.1/bits/unique_ptr.h:396
#7  roc::Device::init() () at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/device/rocm/rocdevice.cpp:511
#8  amd::Device::init() () at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/device/device.cpp:461
#9  amd::Runtime::init() [clone .isra.0] () at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/platform/runtime.cpp:75
#10 0x00007ff8ad21e45d in std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<clIcdGetPlatformIDsKHR::{lambda()#1}>(std::once_flag&, clIcdGetPlatformIDsKHR::{lambda()#1}&&)::{lambda()#1}>(clIcdGetPlatformIDsKHR::{lambda()#1}&)::{lambda()#1}::_FUN() ()
    at /usr/src/debug/rocm-opencl-runtime/ROCm-OpenCL-Runtime-rocm-5.4.3/amdocl/cl_icd.cpp:224
#11 0x00007ff8c28a25bf in __pthread_once_slow
    (once_control=0x7ff8ad31fb54 <clIcdGetPlatformIDsKHR::initOnce>, init_routine=0x7ff8c2ae0230 <std::__once_proxy()>)
    at pthread_once.c:116
#12 0x00007ff8ad21e2a0 in __gthread_once (__func=<optimized out>, __once=0x7ff8ad31fb54 <clIcdGetPlatformIDsKHR::initOnce>)
    at /usr/include/c++/12.2.1/x86_64-pc-linux-gnu/bits/gthr-default.h:700
#13 std::call_once<clIcdGetPlatformIDsKHR(cl_uint, _cl_platform_id**, cl_uint*)::<lambda()> > (__once=..., __f=...)
    at /usr/include/c++/12.2.1/mutex:859
#14 clIcdGetPlatformIDsKHR(cl_uint, cl_platform_id*, cl_uint*) (num_entries=<optimized out>, platforms=0x0, num_platforms=0x7ff8aeffcdbc)
    at /usr/src/debug/rocm-opencl-runtime/ROCm-OpenCL-Runtime-rocm-5.4.3/amdocl/cl_icd.cpp:274
#15 0x00007ff8ae1ea809 in _find_and_check_platforms (num_icds=<optimized out>) at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:479
#16 __initClIcd () at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:890
#17 _initClIcd_real () at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:941
#18 0x00007ff8ae1ec955 in _initClIcd () at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:970
#19 clGetPlatformIDs (num_entries=0, platforms=0x0, num_platforms=0x7ff8aeffcf4c)
    at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:1135
#20 0x00007ff8c3671a33 in cv::ocl::haveOpenCL() () at /usr/src/debug/opencv/opencv-4.8.0/modules/core/src/ocl.cpp:1190
#21 0x00007ff8c3674716 in cv::ocl::OpenCLExecutionContext::getCurrent() ()
    at /usr/src/debug/opencv/opencv-4.8.0/modules/core/src/ocl.cpp:1077
#22 0x00007ff8c367b170 in cv::ocl::Context::getDefault(bool) (initialize=<optimized out>)
    at /usr/src/debug/opencv/opencv-4.8.0/modules/core/src/ocl.cpp:3001
#23 0x000055fee61fa8d5 in OpencvImage::resize_image() (this=this@entry=0x7ff8a8026070)
    at /usr/src/debug/ueberzugpp/ueberzugpp-2.8.8/src/image/opencv.cpp:88
#24 0x000055fee61fc422 in OpencvImage::process_image() (this=this@entry=0x7ff8a8026070)
    at /usr/src/debug/ueberzugpp/ueberzugpp-2.8.8/src/image/opencv.cpp:120
#25 0x000055fee61fcebc in OpencvImage::OpencvImage(Dimensions const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
    (this=this@entry=0x7ff8a8026070, dimensions=..., filename="/home/daniel/sandbox/wallpapers/abstract/Abstract0006.jpg", in_cache=in_cache@entry=false) at /usr/src/debug/ueberzugpp/ueberzugpp-2.8.8/src/image/opencv.cpp:39
#26 0x000055fee6278b06 in std::make_unique<OpencvImage, Dimensions const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool&>(Dimensions const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool&) ()
    at /usr/include/c++/13.1.1/bits/unique_ptr.h:1069
#27 Image::load(Dimensions const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    (dimensions=..., filename="/home/daniel/sandbox/wallpapers/abstract/Abstract0006.jpg")
    at /usr/src/debug/ueberzugpp/ueberzugpp-2.8.8/src/image.cpp:52
#28 0x000055fee6239d79 in Application::execute(std::basic_string_view<char, std::char_traits<char> >)
    (this=this@entry=0x7ffd870ccb20, cmd="{\"action\":\"add\",\"identifier\":\"PREVIEW\",\"max_width\":20,\"max_height\":20,\"x\":3,\"y\":3,\"path\":\"/home/daniel/sandbox/wallpapers/abstract/Abstract0006.jpg\"}") at /usr/include/c++/13.1.1/bits/unique_ptr.h:453
#29 0x000055fee623a258 in Application::socket_loop() (this=0x7ffd870ccb20) at /usr/include/c++/13.1.1/string_view:146
#30 0x00007ff8c2ae1943 in std::execute_native_thread_routine(void*) (__p=0x55fee7fb2d90)
    at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
#31 0x00007ff8c289d44b in start_thread (arg=<optimized out>) at pthread_create.c:444
#32 0x00007ff8c2920e40 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb) 

Another try changes the stacktrace:

Core was generated by `ueberzugpp layer --no-stdin --silent --pid-file /tmp/.7e11b203-a84b-42f5-a009-4'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007ff8c28adc5e in __GI___libc_free (mem=0x1d) at malloc.c:3344
3344	 if (chunk_is_mmapped (p))                       /* release mmapped memory. */                                                      
[Current thread is 1 (Thread 0x7ff8aeffe6c0 (LWP 13134))]
(gdb) bt
#0  0x00007ff8c28adc5e in __GI___libc_free (mem=0x1d) at malloc.c:3344
#1  0x00007ff8c2aaeaba in operator delete(void*) (ptr=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/del_op.cc:49
#2  0x00007ff8c2aaeaea in operator delete[](void*) (ptr=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/del_opv.cc:35
#3  0x00007ff8ad24ee04 in roc::Device::~Device() (this=0x7ff8a8186ac0, this=<optimized out>)
    at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/device/rocm/rocdevice.cpp:260
#4  0x00007ff8ad2cdbdd in roc::Device::~Device() (this=0x7ff8a8186ac0, this=<optimized out>)
    at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/device/rocm/rocdevice.cpp:271
#5  std::default_delete<roc::Device>::operator()(roc::Device*) const (__ptr=0x7ff8a8186ac0, this=<optimized out>)
    at /usr/include/c++/12.2.1/bits/unique_ptr.h:95
#6  std::unique_ptr<roc::Device, std::default_delete<roc::Device> >::~unique_ptr() (this=<synthetic pointer>, this=<optimized out>)
    at /usr/include/c++/12.2.1/bits/unique_ptr.h:396
#7  roc::Device::init() () at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/device/rocm/rocdevice.cpp:511
#8  amd::Device::init() () at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/device/device.cpp:461
#9  amd::Runtime::init() [clone .isra.0] () at /usr/src/debug/rocm-opencl-runtime/ROCclr-rocm-5.4.3/platform/runtime.cpp:75
#10 0x00007ff8ad21e45d in std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<clIcdGetPlatformIDsKHR::{lambda()#1}>(std::once_flag&, clIcdGetPlatformIDsKHR::{lambda()#1}&&)::{lambda()#1}>(clIcdGetPlatformIDsKHR::{lambda()#1}&)::{lambda()#1}::_FUN() ()
    at /usr/src/debug/rocm-opencl-runtime/ROCm-OpenCL-Runtime-rocm-5.4.3/amdocl/cl_icd.cpp:224
#11 0x00007ff8c28a25bf in __pthread_once_slow
    (once_control=0x7ff8ad31fb54 <clIcdGetPlatformIDsKHR::initOnce>, init_routine=0x7ff8c2ae0230 <std::__once_proxy()>)
    at pthread_once.c:116
#12 0x00007ff8ad21e2a0 in __gthread_once (__func=<optimized out>, __once=0x7ff8ad31fb54 <clIcdGetPlatformIDsKHR::initOnce>)
    at /usr/include/c++/12.2.1/x86_64-pc-linux-gnu/bits/gthr-default.h:700
#13 std::call_once<clIcdGetPlatformIDsKHR(cl_uint, _cl_platform_id**, cl_uint*)::<lambda()> > (__once=..., __f=...)
    at /usr/include/c++/12.2.1/mutex:859
#14 clIcdGetPlatformIDsKHR(cl_uint, cl_platform_id*, cl_uint*) (num_entries=<optimized out>, platforms=0x0, num_platforms=0x7ff8aeffcdbc)
    at /usr/src/debug/rocm-opencl-runtime/ROCm-OpenCL-Runtime-rocm-5.4.3/amdocl/cl_icd.cpp:274
#15 0x00007ff8ae1ea809 in _find_and_check_platforms (num_icds=<optimized out>) at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:479
#16 __initClIcd () at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:890
#17 _initClIcd_real () at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:941
#18 0x00007ff8ae1ec955 in _initClIcd () at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:970
#19 clGetPlatformIDs (num_entries=0, platforms=0x0, num_platforms=0x7ff8aeffcf4c)
    at /usr/src/debug/ocl-icd/ocl-icd-2.3.2/ocl_icd_loader.c:1135
#20 0x00007ff8c3671a33 in cv::ocl::haveOpenCL() () at /usr/src/debug/opencv/opencv-4.8.0/modules/core/src/ocl.cpp:1190
#21 0x00007ff8c3674716 in cv::ocl::OpenCLExecutionContext::getCurrent() ()

Strangely, after this happened, when I added --no-opencv to the img script, it did not work for a few times (in a fresh terminal window), but only after some tries (and some new terminal windows), it started to work again. Maybe that's just some irrelevant side-effect, but I wanted to mention it in case it gives a clue to something for you.

@jstkdng
Copy link
Owner

jstkdng commented Jul 10, 2023

yeah, it looks ike it's a probem with rocm and opencl. Maybe those opencl errors are messing with your gpu? Nothing I can do about that.

Just stay with libvips, I should probably add that to the docs.

@DLFW
Copy link
Author

DLFW commented Jul 10, 2023

Hm, strange that such an error does not break something else too... AFAIK, OpenCV is not exactly a niche-thing.

Anyway, enhancing the docs and explaining about these backends is a good idea for sure. How is that? OpenCV and libvips are two alternatives for the X and Wayland “output methods”? But not for sixel, kitty, iterm2, chafa?

No need to answer that here, but a rough overview how these things relate in the readme or some linked, dedicated Markdown file would help users troubleshooting such problems. Maybe some "FAQ" section or something would also be helpful, where problems with certain distros, drivers, and some basic debug-instructions can be collected.

BTW, thanks for the cool project and the great idea to provide a drop-in replacement for the old Überzug! The community really has a need for that. 👍

@DLFW DLFW closed this as completed Jul 10, 2023
@jstkdng
Copy link
Owner

jstkdng commented Jul 10, 2023

OpenCV is not exactly a niche-thing.

yeah, but AMD's opencl implementation has its hiccups. At least it works fine with my 6700XT.

Also, thanks for shilling ueberzugpp in the joshuto repo. I'll add that to the README, hopefully the new documentation as well.

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