mchehab / zbar

ZBar is an open source software suite for reading bar codes from various sources, including webcams. As its development stopped in 2012, I took the task of keeping it updated with the V4L2 API. This is the main repository for it. There's a clone at at LinuxTV.org, and another one at gitlab.
https://linuxtv.org/downloads/zbar/
GNU Lesser General Public License v2.1
1k stars 206 forks source link

zbarcam crashes on ubuntu server #239

Open bedy93 opened 1 year ago

bedy93 commented 1 year ago

Hi all,

I was trying to use zbarcam on some notebooks but it crashes. OS: ubuntu 22.04 lts server & 22.10 server Zbarcam: 0.23.92

I'm using the following command: zbarcam --nodisplay --verbose=3 It gives the following log: https://pastebin.com/pcZcJHUG After v4l2_get_supported_resolutions fails in v4l2_probe_iomode, which leads to a segmentation fault.

I thought I dig into the issue, so I've installed the tools built my own version. Surprisingly that leads to a different failiure(Probably because I haven't set HAVE_SYS_MMAN_H switch...?), see: https://pastebin.com/Nrd71Ebt The v4l2_probe_iomode finishes, but doesn't set vdo->iomode so after the probe_iomode finished it defaults to READWRITE, but it still fails.

I've hardcoded the idomode to MMAP and with that it runs just fine. See: https://pastebin.com/0USHcj0h It also works with USERPTR. (No log saved) Strange that it defaults to READWRITE, which is the only not working option.

So my conclusion is, that there are two issues:

Could you fix this? I can offer some support.

jsfan3 commented 1 year ago

I confirm the same bug on Linux Mint 21.

Harvie commented 1 year ago

I have same issue on Debian 12 (package from debian repo), zbarcam version 0.23.92. It only happens with --nodisplay parameter. Causes segmentation fault when trying to acquire pthread mutex during zbar_processor_init(), precisely zbar_negotiate_format():

(gdb) bt full
#0  0x0000fffff7e31e64 in ___pthread_mutex_lock (mutex=0x98) at ./nptl/pthread_mutex_lock.c:80
        type = <optimized out>
        __PRETTY_FUNCTION__ = "___pthread_mutex_lock"
        id = <optimized out>
#1  0x0000fffff7f6aa58 in zbar_negotiate_format () from /lib/aarch64-linux-gnu/libzbar.so.0
No symbol table info available.
#2  0x0000fffff7f6c894 in zbar_processor_init () from /lib/aarch64-linux-gnu/libzbar.so.0
No symbol table info available.
#3  0x0000aaaaaaaa1ba4 in main (argc=<optimized out>, argv=<optimized out>) at zbarcam/zbarcam.c:307
        video_device = 0xaaaaaaaa2a18 ""
        dbus = 1
        display = 0
        infmt = 0
        outfmt = 0
        i = 4
        active = <optimized out>
Harvie commented 1 year ago

Probably related to calling window_lock() when in --nodisplay mode?

Harvie commented 1 year ago

Which was probably fixed in 8c9b148c15276d9e99ca1f5f8915e52b25b46765 @bedy93 @jsfan3 can you test latest git master please?