public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/347] New: pthread_create hang after a failure
@ 2004-08-26 15:50 sebastien dot decugis at ext dot bull dot net
  2004-08-26 15:53 ` [Bug nptl/347] " sebastien dot decugis at ext dot bull dot net
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: sebastien dot decugis at ext dot bull dot net @ 2004-08-26 15:50 UTC (permalink / raw)
  To: glibc-bugs

When trying to create threads with a high priority, as a normal user, the
function pthread_create will return EPERM on the first try then hang in the
second call.

Compiler is gcc 3.4.1

Kernel is 2.6.8.1 smp running on a 2-way i686.

Glibc is a recent CVS with NPTL addon (tried with CVS from 2004-07-26 and
2004-08-23).

Here is the strace output corresponding to the attached sample:
[...skip...]
sched_get_priority_max(SCHED_FIFO)      = 99
sched_get_priority_min(SCHED_FIFO)      = 1
mmap2(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x40144000
brk(0)                                  = 0x804a000
brk(0x806b000)                          = 0x806b000
mprotect(0x40144000, 4096, PROT_NONE)   = 0
sched_get_priority_min(SCHED_FIFO)      = 1
sched_get_priority_max(SCHED_FIFO)      = 99
clone(child_stack=0x40944b28,
flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,
parent_tidptr=0x40944bf8, {entry_number:6, base_addr:0x40944bb0, limit:1048575,
seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0,
useable:1}, child_tidptr=0x40944bf8) = 17737
sched_setscheduler(0, SCHED_FIFO, { 99 }) = -1 EPERM (Operation not permitted)
tgkill(17736, 0, SIGRTMIN)              = -1 EINVAL (Invalid argument)
sched_get_priority_min(SCHED_FIFO)      = 1
sched_get_priority_max(SCHED_FIFO)      = 99
futex(0x40944d94, FUTEX_WAIT, 2, NULL <unfinished ...>

-- 
           Summary: pthread_create hang after a failure
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: sebastien dot decugis at ext dot bull dot net
                CC: glibc-bugs at sources dot redhat dot com


http://sources.redhat.com/bugzilla/show_bug.cgi?id=347

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug nptl/347] pthread_create hang after a failure
  2004-08-26 15:50 [Bug nptl/347] New: pthread_create hang after a failure sebastien dot decugis at ext dot bull dot net
@ 2004-08-26 15:53 ` sebastien dot decugis at ext dot bull dot net
  2004-08-30 11:25 ` jakub at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: sebastien dot decugis at ext dot bull dot net @ 2004-08-26 15:53 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From sebastien dot decugis at ext dot bull dot net  2004-08-26 15:52 -------
Created an attachment (id=176)
 --> (http://sources.redhat.com/bugzilla/attachment.cgi?id=176&action=view)
Testcase to reproduce the bug

Just compile with:
$CC $CFLAGS $LDFLAGS -lpthread -o fifo fifo.c

Note the test runs successfully as root or with an older glibc.

-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=347

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug nptl/347] pthread_create hang after a failure
  2004-08-26 15:50 [Bug nptl/347] New: pthread_create hang after a failure sebastien dot decugis at ext dot bull dot net
  2004-08-26 15:53 ` [Bug nptl/347] " sebastien dot decugis at ext dot bull dot net
@ 2004-08-30 11:25 ` jakub at redhat dot com
  2004-08-30 12:17 ` sebastien dot decugis at ext dot bull dot net
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at redhat dot com @ 2004-08-30 11:25 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2004-08-30 11:25 -------
Can't reproduce, works just fine here (both pthread_create calls report EPERM).
But the strace listing you provided definitely looks very wrong:
 sched_setscheduler(0, SCHED_FIFO, { 99 }) = -1 EPERM (Operation not permitted)
 tgkill(17736, 0, SIGRTMIN)              = -1 EINVAL (Invalid argument)
(instead of 0 there should be 17737). When I run it under strace I get
the right tid there.
To both calls, pd->tid is passed and pd->tid is supposed to be set by the kernel
in the clone syscall (&pd->tid is passed as both parent_tidptr and child_tidptr
argument).


-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=347

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug nptl/347] pthread_create hang after a failure
  2004-08-26 15:50 [Bug nptl/347] New: pthread_create hang after a failure sebastien dot decugis at ext dot bull dot net
  2004-08-26 15:53 ` [Bug nptl/347] " sebastien dot decugis at ext dot bull dot net
  2004-08-30 11:25 ` jakub at redhat dot com
@ 2004-08-30 12:17 ` sebastien dot decugis at ext dot bull dot net
  2004-09-09 12:39 ` sebastien dot decugis at ext dot bull dot net
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: sebastien dot decugis at ext dot bull dot net @ 2004-08-30 12:17 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From sebastien dot decugis at ext dot bull dot net  2004-08-30 12:17 -------
It looks like a very strange issue to me, but I can't explain it:

-> The test machine is a bi-686 CPU with 2GB Ram. The distrib is Fedora Core 2
up to date with "yum". The kernel is 2.6.8.1 from www.kernel.org. The libc is a
fresh CVS in a jailroot. The sample executed directly from a console on the test
machine will hang.

-> When I connect (with ssh) to the test machine from another machine running a
Fedora Core 2 also up to date with yum, the same problem appears (hang).

-> When I connect (ssh) to the test machine from a third machine running Red Hat
9, the sample won't hang.

I can only assume there is something with the RH9 ssh client... but can't figure
what.

What additionnal information could I provide which would be usefull?


-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=347

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug nptl/347] pthread_create hang after a failure
  2004-08-26 15:50 [Bug nptl/347] New: pthread_create hang after a failure sebastien dot decugis at ext dot bull dot net
                   ` (2 preceding siblings ...)
  2004-08-30 12:17 ` sebastien dot decugis at ext dot bull dot net
@ 2004-09-09 12:39 ` sebastien dot decugis at ext dot bull dot net
  2004-09-09 12:52 ` sebastien dot decugis at ext dot bull dot net
  2004-09-10 14:16 ` sebastien dot decugis at ext dot bull dot net
  5 siblings, 0 replies; 7+ messages in thread
From: sebastien dot decugis at ext dot bull dot net @ 2004-09-09 12:39 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From sebastien dot decugis at ext dot bull dot net  2004-09-09 12:39 -------
I've new information (and I think I found out where the bug come from).

I've run into the same issue again with a newer glibc (CVS from 2004/09/06).

This time I used another sample to reproduce the bug (it was not the initial
intent), code of which can be found here:
http://nptl.bullopensource.org/phpBB/viewtopic.php?t=34

I found that even if the pthread_create fails, the not-created thread will
execute for some instructions... (strange isn't it?). 

This leads to a hang in my sample. I was able to reproduce this about 2 times
out of three.

A simpler sample could be:

void * th(void * arg) { printf("should not execute!!"); }
int main()
{
/* create a thread attribute object with SCHED_RR and priority = 99 */
/* create the thread with this attribute. This shall fail when executed as an
user -- not root */
}

Hope this helps...



-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=347

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug nptl/347] pthread_create hang after a failure
  2004-08-26 15:50 [Bug nptl/347] New: pthread_create hang after a failure sebastien dot decugis at ext dot bull dot net
                   ` (3 preceding siblings ...)
  2004-09-09 12:39 ` sebastien dot decugis at ext dot bull dot net
@ 2004-09-09 12:52 ` sebastien dot decugis at ext dot bull dot net
  2004-09-10 14:16 ` sebastien dot decugis at ext dot bull dot net
  5 siblings, 0 replies; 7+ messages in thread
From: sebastien dot decugis at ext dot bull dot net @ 2004-09-09 12:52 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From sebastien dot decugis at ext dot bull dot net  2004-09-09 12:52 -------
Created an attachment (id=190)
 --> (http://sources.redhat.com/bugzilla/attachment.cgi?id=190&action=view)
Simple file to show the bug origin

I often get the following trace from this program execution (The "should not
see me" shows that the test failed) -- kernel is 2.6.8.1; NPTL from 2004/09/06:


[thedoc@nptl tmp]$ ./create
Test starting...
Thread attribute is ready, creating the thread...
Test passed
Should not see me


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #176 is|0                           |1
           obsolete|                            |


http://sources.redhat.com/bugzilla/show_bug.cgi?id=347

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug nptl/347] pthread_create hang after a failure
  2004-08-26 15:50 [Bug nptl/347] New: pthread_create hang after a failure sebastien dot decugis at ext dot bull dot net
                   ` (4 preceding siblings ...)
  2004-09-09 12:52 ` sebastien dot decugis at ext dot bull dot net
@ 2004-09-10 14:16 ` sebastien dot decugis at ext dot bull dot net
  5 siblings, 0 replies; 7+ messages in thread
From: sebastien dot decugis at ext dot bull dot net @ 2004-09-10 14:16 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From sebastien dot decugis at ext dot bull dot net  2004-09-10 14:16 -------
reposted as bug 379 while the problem does not fit anymore in this bug' description.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://sources.redhat.com/bugzilla/show_bug.cgi?id=347

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-09-10 14:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-26 15:50 [Bug nptl/347] New: pthread_create hang after a failure sebastien dot decugis at ext dot bull dot net
2004-08-26 15:53 ` [Bug nptl/347] " sebastien dot decugis at ext dot bull dot net
2004-08-30 11:25 ` jakub at redhat dot com
2004-08-30 12:17 ` sebastien dot decugis at ext dot bull dot net
2004-09-09 12:39 ` sebastien dot decugis at ext dot bull dot net
2004-09-09 12:52 ` sebastien dot decugis at ext dot bull dot net
2004-09-10 14:16 ` sebastien dot decugis at ext dot bull dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).