threads/146917: open(), accept() are not thread safe
HaiYu Wu
cfishwu at corp.netease.com
Mon May 24 13:20:01 UTC 2010
>Number: 146917
>Category: threads
>Synopsis: open(), accept() are not thread safe
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: freebsd-threads
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon May 24 13:20:00 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: HaiYu Wu
>Release: FreeBSD 7.3-RELEASE
>Organization:
Netease Inc.
>Environment:
FreeBSD onlinegame-10-183 7.3-RELEASE FreeBSD 7.3-RELEASE #0: Sun Mar 21 06:15:01 UTC 2010 root at walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
My Application is in Freebsd 7.3, has two threads. use -pthread options to gcc(gcc 4.2.1). the Threads's breif flow as bellow:
Thread A: is the main thread which deal with the connections, accept connection, read connection and make a request to push into a queue.
Thread B: is the work thread which wait for request from the queue, and deal with it. when dealing with the request, sometimes will open a file to write some data. I use system call open() to open file and write(), mostly, both of threads work well. but sometimes write() is failed and the errno is 9. If I migrate the open() operation to the main thread A, never open() in the Thread B, the failure is disappear.
So, I doubt that some system call , such as accep(), open(), fopen() which operate the File Descriptor are
not thread safe. Is this True ?
>How-To-Repeat:
above mentioned
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-threads
mailing list