CUPS crashes on shutdown when taking down Avahi threaded poll #4213

Closed
michaelrsweet opened this Issue Oct 15, 2012 · 2 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Oct 15, 2012

Version: 1.6.1
CUPS.org User: till.kamppeter

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.

Collaborator

michaelrsweet commented Oct 17, 2012

CUPS.org User: mike

Till, thanks, committed for the next release.

Collaborator

michaelrsweet commented Oct 17, 2012

"cupsd-no-crash-on-avahi-threaded-poll-shutdown.patch":

--- 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;

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment