[HIGH] STR #4213: CUPS crashes on shutdown when taking down Avahi threaded poll

[email protected] Mon, 15 Oct 2012 15:21:25 -0700 (PDT)
Newsgroups gmane.comp.printing.cups.bugs
Message-ID <[email protected]>
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

I have CUPS 1.6.1 on Ubuntu Quantal (12.10), sharing printers via
Avahi-based DNS-SD. I am using the patches of STR #4155, STR #4156, STR
#4157, STR #4158, and STR #4159 and also the recebt crash fix patches for
STR #4183, STR #4192, and STR #4200.

After all this there is still a crash bug in CUPS, occuring on shutdown,
according to the stack traces on the Ubuntu bug report and its duplicates
when the Avahi threaded poll is shut down.

See

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1034045

and the stack traces

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1034045/+attachment/3251529/+files/ThreadStacktrace.txt

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1034045/+attachment/3251527/+files/Stacktrace.txt

The fix is attached and the problem was a wrong sequence of shutting down
the Avahi threaded poll. See

http://avahi.org/wiki/RunningAvahiClientAsThread

function zeroconf_shutdown() in the example code. A
avahi_threaded_poll_stop() is needed before calling avahi_client_free().
This is missing in the dnssdStop() function in scheduler/dirsvc.c.

The reporter of the Ubuntu bug confirms that with my patch the crash goes
away.

Note that this is not a duplicate of STR #4183 and STR #4192. STR #4180 is
the same as this one, not a duplicate of STR #4183.

Link: http://www.cups.org/str.php?L4213
Version: 1.6.1

_______________________________________________
cups-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/cups-bugs
cupsd-no-crash-on-avahi-threaded-poll-shutdown.patch (text/plain, 225 B)
--- a/scheduler/dirsvc.c
+++ b/scheduler/dirsvc.c
@@ -2367,6 +2367,7 @@
   DNSSDMaster = NULL;
 
 #  else /* HAVE_AVAHI */
+  avahi_threaded_poll_stop(DNSSDMaster);
   avahi_client_free(DNSSDClient);
   DNSSDClient = NULL;