Re: LSB problems with: pthread_join/pthread_create

Andrew Josey <[email protected]>
Newsgroups gmane.linux.lsb.test-suite
Message-ID <[email protected]>
fyi, this is my engineers assessment on these tests...
regards
Andrew


I agree with their assessment - there is a race condition in these
tests, as the detached thread could exit before pthread_join() is called.

They are also right about EINVAL being a "may fail".  This means to fix
the problem properly will need more than just delaying the exit of the
detached thread.


> ---------------
> 
>  LSB bug #1055: /tset/PTHR.os/thread/pthread_join/T.pthread_join and T.pthread_create
> <bugbot>   Component: lsb-runtime-tests, Severity: normal, Status: NEW
> <bugbot>   http://bugs.linuxbase.org/show_bug.cgi?id=1055
> 
> The pthread_join (once every five times) test and pthread_create test both fails
> randomly. 
> 
> Went over with Ulrich and has determined that this is because it creates a
> thread as detached and then uses pthread_join.  But there is no guarantee that
> the thread is still running and then it is wrong to use the thread descriptor
> this can be solved by delaying the thread (with a mutex or whatever) until the
> pthread_join test is over. 
> 
> The EINVAL error is a "may" error (i.e., not mandatory)
> 
> Filed both lsb-runtime error as the same bug, if it is required to be separated,
> please let me know.
> 
> ------- Additional Comment #1 From Lawrence Lim 2005-08-01 22:22 [reply] -------
> 
> 10|1013 /tset/PTHR.os/thread/pthread_create/T.pthread_create 13:42:00|TC Start,
> scenario ref 1022-0
> 15|1013 3.6-lite 15|TCM Start
> 400|1013 4 1 13:42:00|IC Start
> 200|1013 4 13:42:00|TP Start
> 520|1013 4 00013460 1 1|A call to pthread_create(thread, attr, start_routine, arg)
> 520|1013 4 00013460 1 2|creates a new thread with the attributes specified by attr
> 520|1013 4 00013460 1 3|within the process containing the calling thread, stores
> 520|1013 4 00013460 1 4|the thread identifier of the newly created thread in the
> 520|1013 4 00013460 1 5|location referenced by thread, causes the newly created
> 520|1013 4 00013460 1 6|thread to execute the routine referenced by start_routine
> 520|1013 4 00013460 1 7|with arg as its sole argument, and returns 0 if successful.
> 520|1013 4 00013460 1 8|Posix Ref: Component PTHREAD_CREATE
> 520|1013 4 00013460 1 9|Assertion 9945-1:1996 16.2.2.2-4(A)
> 520|1013 4 00013460 9 1|waitpid() failed - errno 10 (ECHILD)
> 520|1013 4 00013460 11 1|tet_fork, expected 0, got -1
> 220|1013 4 2 13:42:00|UNRESOLVED
> 410|1013 4 1 13:42:00|IC End
> 
> 10|1017 /tset/PTHR.os/thread/pthread_join/T.pthread_join 13:42:04|TC Start,
> scenario ref 1026-0
> 15|1017 3.6-lite 7|TCM Start
> 400|1017 4 1 13:42:20|IC Start
> 200|1017 4 13:42:20|TP Start
> 520|1017 4 00013665 1 1|When the value specified by thread does not refer to a
> thread
> 520|1017 4 00013665 1 2|that can be joined,
> 520|1017 4 00013665 1 3|then a call to pthread_join(thread, value_ptr) shall fail
> 520|1017 4 00013665 1 4|and return EINVAL.
> 520|1017 4 00013665 1 5|Posix Ref: Component PTHREAD_JOIN
> 520|1017 4 00013665 1 6|Assertion 9945-1:1996 16.2.3.4-4(A)
> 520|1017 4 00013665 4 1|waitpid() failed - errno 10 (ECHILD)
> 520|1017 4 00013665 5 1|tet_fork, expected 0, got -1
> 220|1017 4 2 13:42:20|UNRESOLVED
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.