[sane-devel] sane_init()/sane_exit() crashes on debian systems / not on e.g. arch linux
paddy-hack at member.fsf.org
Thu May 4 11:36:58 UTC 2017
> Hi all,
> the following small program regularly crashes on debian based system
> when inserting / removing a device. This does not happen on e.g. arch
> linux or gentoo systems.
A bit late perhaps, but I've been trying to reproduce this without any
I'm using Debian stretch (9.0 to be), last updated 2017-05-01 with a
default SANE configuration. I don't have scanbd installed and don't
have saned set up. I have an EPSON PM-A750 attached which is supported
by the epson2 backend.
I saved your program to debian-crash.c and compiled with:
gcc -lsane -o debian-crash debian-crash.c
Running ./debian-crash (I'm a member of the scanner group so no sudo is
required) did not produce the problem you describe. At least not in the
5 or 6 cycles I let it run for before killing it with Ctrl-C.
> Investigating the problem further reveals that on debian based systems
> every iteration starts a new thread ending up with tons of threads:
> thats obviously the problem here.
Hmm, tons of threads. There is nothing in the debian/patches/ (for
libsane-1.0.25-4) that changes the use of threads anywhere in the
sane-backends code. They only remove unneeded dependencies on
sanei/sanei_thread.lo and $(PTHREADS_LIB) for libsane.la (which is
really the dll backend).
So I think this is probably a backend specific issue. Since scanbd
requires the use of saned, my first suspect is the net backend but it
may be any other thread using backend as well.
The net backend does not use the sanei_thread API. It does use Avahi
thread APIs, if that's enabled (they are on Debian). Are those wrecking
the havoc you see? Could it be that libavahi changes triggered this?
Is any other backend responsible for this? If so, which one(s)?
> On ArchLinux the sane_exit() call termintates the thread started in
> sane_init() abd therefore no crash happens here.
I'm not familiar with the way Archlinux organizes its patches but tried
to find what you are talking about nevertheless. No such luck.
I found a network.patch that fixes something in sanei_tcp but without
any thread implications. There was a kodakaio avahi related patch as
well but that got included in sane-backends-1.0.25 and no longer seems
to get applied to Archlinux' sane-1.0.25-2.
> Any reasons or plans to fix that?
Only if I know what backend is broken and in what way ;-)
BTW, a patch would be most helpful ;-)
Hope this helps,
Olaf Meeuwissen, LPIC-2 FSF Associate Member since 2004-01-27
GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13 F43E B8A4 A88A F84A 2DD9
Support Free Software https://my.fsf.org/donate
Join the Free Software Foundation https://my.fsf.org/join
More information about the sane-devel