Re: hangs in flockfile() during fread() or fclose()
On Thu, Jul 10, 2014 at 10:30 AM, Paul Smith <paul@mad-scientist.net> wrote:
Am I understanding the code correctly, or did I miss something? Should I file a bug? If so where's the best place?
Looks like a bug to me. Here is a test case - compiled with clang and run with MallocScribble=1 (not sure if necessary), it eventually hangs. You can file bugs at https://bugreport.apple.com. #include <pthread.h> #include <stdio.h> #include <unistd.h> #include <assert.h> #include <stdlib.h> #include <sys/resource.h> volatile int ready; static void *thread(void *_) { ready = 1; while(1) fflush(NULL); } int main() { assert(!setrlimit(RLIMIT_NOFILE, (struct rlimit[]) {{9000, 9000}})); pthread_t pt; pthread_create(&pt, NULL, thread, NULL); while(!ready) ; FILE *fp[8000]; for(int i = 0; i < 8000; i++) { fp[i] = fopen("/usr/share/dict/words", "r"); assert(fp[i]); } for(int i = 0; i < 8000; i++) fclose(fp[i]); printf("ok\n"); // try again (in a new process to reset libc structures) assert(!execl("./fopendl", "./fopendl", NULL)); } _______________________________________________ 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: https://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.app... This email sent to site_archiver@lists.apple.com
participants (1)
-
comex