Hi, On 09/06/2013 04:58 PM, Nathan Hjelm wrote: > > On Sep 6, 2013, at 4:58 AM, Hans de Goede <hdego...@redhat.com> wrote: > >> Hi, >> >> On 09/05/2013 03:14 AM, Xiaofan Chen wrote: >>> On Thu, Sep 5, 2013 at 3:26 AM, Hans de Goede <hdego...@redhat.com> wrote: >>>> Hi, >>>> >>>> As discussed in much detail here: >>>> https://bugzilla.redhat.com/show_bug.cgi?id=1003193 >>>> >>>> Calling libusb_exit from atexit from libusb-compat-0.1.5 causes >>>> some apps to break. >>>> >>>> The app in question is the scanimage app from sane-backends, which >>>> uses atexit for cleanup itself. >>>> >>>> So what happens is the libusb-compat atexit handler runs first, and >>>> then the scanimage atexit cleanup code runs, and tries to cleanly >>>> shutdown the scanner (which may require communicating to it). >>>> ... >>>> I consider this behavior with some old apps a way bigger problem then the >>>> memory / resource leak we had before, therefor I suggest reverting the >>>> atexit changes to libusb-compat. >>>> >>> >>> I agree. >>> >>> On the other hand, maybe we then have to document this limitation >>> of libusb-compat. >> >> You mean simply document that atexit is used and apps must not make any calls >> from atexit because there are no ordering guarantees? Or you mean revert >> the patch and then document the resource leak ? >> >> Also what do others think? Pete ? Nathan ? > > I don’t like re-introducing a leak but it looks unavoidable in this case. > There may be similar issues with the atexit function used by the darwin > backend. I will take a look and see what I can do there.
Well, alternatively we could document that libusb-compat uses atexit for cleanup, and that apps using it should either not access libusb from their own atexit handlers, or register their atexit handler after calling libusb_init (atexit handlers are called in reverse registration order). Regards, Hans ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel