Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 May 2010 13:13:05 GMT
From:      HaiYu Wu <cfishwu@corp.netease.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   threads/146917: open(), accept() are not thread safe
Message-ID:  <201005241313.o4ODD5gD050615@www.freebsd.org>
Resent-Message-ID: <201005241320.o4ODK1xI020934@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005241313.o4ODD5gD050615>