site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=haller-berlin.de; s=mail_2009081900; h=Message-ID:Date:From:Subject:In-Reply-To:Cc:To; bh=rqaus1EYVneAU/HgqHKwcyHm/S4sM8ZD0OoFDzetFQM=; b=d/XKEedvJv36BElU1wsNDplQI6v43OERg3BwGEsheE/lP/6MG/U6IP3zpbWN+Hw5dqqM53LWe7ZH/z6BdxGsLX7gnLRBmoMTguXxSbGecFPU6oGoAbaiyfwuq3sf2IKnQLKwt1WRoNp5ncU1VLbeyCJlcXBa5U7TzfFYn3/p3H0=; User-agent: MacSOUP/2.8.3 (Mac OS X version 10.6.3 (x86)) Terry Lambert <tlambert@apple.com> wrote:
On Apr 15, 2010, at 8:54 AM, Stefan Haller wrote:
We are investigating a reproducible crash that happens in Bonjour code when we have many files open. The crash happens in DNSServiceProcessResult (part of mDNSResponder), which contains the following code:
static int more_bytes(dnssd_sock_t sd) { struct timeval tv = { 0, 0 }; fd_set readfds; FD_ZERO(&readfds); FD_SET(sd, &readfds); return(select(sd+1, &readfds, (fd_set*)NULL, (fd_set*)NULL, &tv)
0); }
Are you recompiling this code yourself? If so, here's the trivial fix for this:
No. This code is running whenever my application opens an NSSavePanel; I don't seem to have any control over this.
All that said, there is no existing Apple software which uses the DNSServiceProcessResult() function,
Huh? The crash I described happens with the following backtrace: #0 0x994df6d7 in DNSServiceProcessResult () #1 0x9416d500 in BonjourBrowser::socketCallBack () #2 0x93d8e1ae in __CFSocketDoCallback () #3 0x93d8dc97 in __CFSocketPerformV0 () #4 0x93d47ff1 in __CFRunLoopDoSources0 () #5 0x93d45c1f in __CFRunLoopRun () #6 0x93d450f4 in CFRunLoopRunSpecific () #7 0x93d44f21 in CFRunLoopRunInMode () #8 0x909eb0fc in RunCurrentEventLoopInMode () #9 0x909eaded in ReceiveNextEventCommon () #10 0x909ead36 in BlockUntilNextEventMatchingListInMode () #11 0x96567135 in _DPSNextEvent () #12 0x96566976 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () #13 0x967de021 in -[NSApplication _realDoModalLoop:peek:] () #14 0x967dd79d in -[NSApplication runModalForWindow:] () #15 0x96a71379 in -[NSSavePanel runModal] () #16 0x96a6a9f1 in -[NSSavePanel runModalForDirectory:file:] () #17 <my code> As far as I can tell, BonjourBrowser::socketCallBack is in OSServices.framework, which is part of CoreServices.framework. The example program that I attached to <rdar://problem/7701369> demonstrates this nicely with minimal code. Here is all it takes to make it crash: static void raiseOpenFileLimit() { struct rlimit lim; if (getrlimit(RLIMIT_NOFILE, &lim) != 0) { perror("getrlimit:"); exit(-1); } lim.rlim_cur = (rlim_t)4000; if (setrlimit(RLIMIT_NOFILE, &lim) != 0) { perror("setrlimit:"); exit(-1); } } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Alternatively, type "ulimit -n 2000" in a shell and start the // application from that shell. raiseOpenFileLimit(); #ifdef __LP64__ const int kLimit = 2044; #else const int kLimit = 1665; #endif // Use up file descriptors int i, fd; for (i = 0, fd = -1; fd < kLimit; i++) { fd = open("/dev/null", O_RDONLY); if (fd == -1) { perror("open:"); exit(-1); } i++; } printf("used up %d file descriptors, next file descriptor is %d\n", i, fd + 1); NSSavePanel *panel = [NSSavePanel savePanel]; // crash: [panel runModalForDirectory:@"/tmp" file:@"bla.txt"]; } -- Stefan Haller Berlin, Germany http://www.haller-berlin.de/ _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com