public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug linuxthreads/261] New: pthread_cond_timedwait_relative hangs
@ 2004-07-10 14:04 jiten dot a at gmail dot com
  2004-07-10 14:06 ` [Bug linuxthreads/261] " jiten dot a at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jiten dot a at gmail dot com @ 2004-07-10 14:04 UTC (permalink / raw)
  To: glibc-bugs

RedHat 7.3, glibc-2.2.5-34, kernel 2.4.18-3.

Following is a gdb trace, I get similar trace whenever my program hangs.

(gdb) where
#0  0x40ddf063 in __pthread_unlock () from /lib/i686/libpthread.so.0
#1  0x40dda25e in pthread_cond_timedwait_relative () from
/lib/i686/libpthread.so.0
#2  0x4024e04d in sr_waitsync () from /usr/dialogic/lib/libsrl.so
#3  0x4024dd51 in sr_waitevtEx () from /usr/dialogic/lib/libsrl.so
#4  0x080b8380 in CCrbt::MainThread (this=0x99c7d68) at Functions.cpp:13444
#5  0x080f30be in beginCrbtOnChannel (p_ptr=0x99c7d68) at main.cpp:1514
#6  0x4054b816 in ACE_Thread_Adapter::invoke_i (this=0x99df180) at
Thread_Adapter.cpp:150
#7  0x4054b613 in ACE_Thread_Adapter::invoke (this=0x99df180) at
Thread_Adapter.cpp:93
#8  0x4050d774 in ace_thread_adapter (args=0x99df180) at
Base_Thread_Adapter.cpp:121
#9  0x40ddafef in pthread_start_thread () from /lib/i686/libpthread.so.0

ps awxr always returns pid of the thread in unlock. All other threads are trying
 to lock. Other application threads are running fine at this moment.

I have reproduced with a simple test code. How can I upload it?

-- 
           Summary: pthread_cond_timedwait_relative hangs
           Product: glibc
           Version: 2.2.5
            Status: NEW
          Severity: critical
          Priority: P1
         Component: linuxthreads
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: jiten dot a at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


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

------- 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] 6+ messages in thread

* [Bug linuxthreads/261] pthread_cond_timedwait_relative hangs
  2004-07-10 14:04 [Bug linuxthreads/261] New: pthread_cond_timedwait_relative hangs jiten dot a at gmail dot com
@ 2004-07-10 14:06 ` jiten dot a at gmail dot com
  2004-07-11  5:49 ` jiten dot a at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jiten dot a at gmail dot com @ 2004-07-10 14:06 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jiten dot a at gmail dot com  2004-07-10 14:06 -------
Created an attachment (id=130)
 --> (http://sources.redhat.com/bugzilla/attachment.cgi?id=130&action=view)
This is a test program that hangs after an hour or so on my machine.

Please compile using following command line.

g++ -D_REENTRANT -ggdb	test2.cc -lpthread -o test

-- 


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

------- 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] 6+ messages in thread

* [Bug linuxthreads/261] pthread_cond_timedwait_relative hangs
  2004-07-10 14:04 [Bug linuxthreads/261] New: pthread_cond_timedwait_relative hangs jiten dot a at gmail dot com
  2004-07-10 14:06 ` [Bug linuxthreads/261] " jiten dot a at gmail dot com
@ 2004-07-11  5:49 ` jiten dot a at gmail dot com
  2004-07-11 10:00 ` jiten dot a at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jiten dot a at gmail dot com @ 2004-07-11  5:49 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jiten dot a at gmail dot com  2004-07-11 05:49 -------
Created an attachment (id=131)
 --> (http://sources.redhat.com/bugzilla/attachment.cgi?id=131&action=view)
Another test program that hangs faster than the earlier one


-- 


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

------- 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] 6+ messages in thread

* [Bug linuxthreads/261] pthread_cond_timedwait_relative hangs
  2004-07-10 14:04 [Bug linuxthreads/261] New: pthread_cond_timedwait_relative hangs jiten dot a at gmail dot com
  2004-07-10 14:06 ` [Bug linuxthreads/261] " jiten dot a at gmail dot com
  2004-07-11  5:49 ` jiten dot a at gmail dot com
@ 2004-07-11 10:00 ` jiten dot a at gmail dot com
  2004-07-14 12:07 ` jakub at redhat dot com
  2004-07-19 11:27 ` jakub at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jiten dot a at gmail dot com @ 2004-07-11 10:00 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jiten dot a at gmail dot com  2004-07-11 10:00 -------
(From update of attachment 131)
>#include <pthread.h>
>#include <iostream>
>#include <unistd.h>
>#include <stdlib.h>
>#include <string.h>
>#include <errno.h>
>#include <sys/time.h>
>
>#define NUM_LOADERS 240
>#define TIMEOUT_MILLISEC 20
>
>
>using namespace std;
>
>bool resource_avl= true;
>
>//pthread_mutex_t mu	=	PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
>pthread_mutex_t mu	=	PTHREAD_MUTEX_INITIALIZER;
>pthread_cond_t  co	=	PTHREAD_COND_INITIALIZER;
>
>
>
>void *loader(void*)
>{
>	pthread_detach(pthread_self());
>				
>	struct timeval tv;
>	struct timespec ts;
>	struct timespec tts;
>
>	int ret=0;
>	
>	while(1)
>	{
>		pthread_mutex_lock(&mu);
>
>		while(!resource_avl)
>		{
>				gettimeofday(&tv,NULL);
>				ts.tv_sec = tv.tv_sec;
>				ts.tv_nsec = (tv.tv_usec + TIMEOUT_MILLISEC*1000)*1000;
>				ret = pthread_cond_timedwait(&co,&mu,&ts);
>				if(ret == ETIMEDOUT)
>				{
>					cout << "Timed out:" << pthread_self() << endl;
>				}
>		}
>
>		cout << "TAKEN: "<< pthread_self() <<endl;
>		cout.flush();
>		resource_avl=false;
>		pthread_mutex_unlock(&mu);
>		
>		cout << "WORKING: "<< pthread_self() <<endl;
>
>		tts.tv_sec = 0;
>		tts.tv_nsec = 10*1000000;
>		nanosleep(&tts,NULL);	
>
>
>		pthread_mutex_lock(&mu);
>
>		cout << "RELEASED: "<< pthread_self() <<endl;
>
>		resource_avl=true;
>
>		pthread_cond_signal(&co);
>		pthread_mutex_unlock(&mu);
>		
>		tts.tv_sec = 0;
>		tts.tv_nsec = 70*1000000;
>		nanosleep(&tts,NULL);	
>	
>	}
>
>				
>}
>
>
>#define SIZE 1024*1024
>
>void *doPaging(void *f)
>{
>    char *x;
>    int counter=0;
>    
>    while(1) {
>         counter++;   
>         if(counter%20 == 0) counter=1;
>
>         x = new char[SIZE * counter%20 ];
>         cout << "Done new" << endl;cout.flush();
>      
>         usleep(10000);
>         delete []x;
>    }    
>}
>/*
>void *doPaging(void *f)
>{
>    char *x, *p;
>    x = (char*)malloc(SIZE*sizeof(char));
>
>    if(!x)
>    {
>      cout << "Couldnt allocate memory for test" << endl;
>      exit (1);      
>    }
>    
>    while(1) {
>         memset(x,0 ,SIZE*sizeof(char));
>         cout << "Done memset" << endl;cout.flush();
>      usleep(10000);
>    }    
>}
>*/
>
>
>int main()
>{
>	pthread_t load_tid[NUM_LOADERS];
>	int ret=0;
>		
>	for(int i=0; i < NUM_LOADERS; i++)
>	{
>		ret = pthread_create(&load_tid[i], NULL, loader, NULL);
>		if(ret != 0)
>		{
>			cout << "Error Creating thread" << endl;			
>		}
>		else
>		{
>			cout << "Thread created successfully" <<endl;			
>		}
>	}
>	
>  pthread_t pagerid;
>	ret = pthread_create(&pagerid, NULL, doPaging, NULL);
>  if(ret != 0)
>	{
>		cout << "Error Creating Pager thread" << endl;			
>	}
>	else
>	{
>		cout << "Pager Thread created successfully" <<endl;			
>	}
>
>	while(1)
>		sleep(100000);
>				
>}


-- 


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

------- 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] 6+ messages in thread

* [Bug linuxthreads/261] pthread_cond_timedwait_relative hangs
  2004-07-10 14:04 [Bug linuxthreads/261] New: pthread_cond_timedwait_relative hangs jiten dot a at gmail dot com
                   ` (2 preceding siblings ...)
  2004-07-11 10:00 ` jiten dot a at gmail dot com
@ 2004-07-14 12:07 ` jakub at redhat dot com
  2004-07-19 11:27 ` jakub at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at redhat dot com @ 2004-07-14 12:07 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2004-07-14 12:07 -------
Please retry with current glibc, glibc 2.2.5 is really very old.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


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

------- 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] 6+ messages in thread

* [Bug linuxthreads/261] pthread_cond_timedwait_relative hangs
  2004-07-10 14:04 [Bug linuxthreads/261] New: pthread_cond_timedwait_relative hangs jiten dot a at gmail dot com
                   ` (3 preceding siblings ...)
  2004-07-14 12:07 ` jakub at redhat dot com
@ 2004-07-19 11:27 ` jakub at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at redhat dot com @ 2004-07-19 11:27 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2004-07-19 11:27 -------
Per e-mail discussion, closing as WORKSFORME, seems to be LinuxThreads 2.2.x
specific.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |WORKSFORME


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

------- 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] 6+ messages in thread

end of thread, other threads:[~2004-07-19 11:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-10 14:04 [Bug linuxthreads/261] New: pthread_cond_timedwait_relative hangs jiten dot a at gmail dot com
2004-07-10 14:06 ` [Bug linuxthreads/261] " jiten dot a at gmail dot com
2004-07-11  5:49 ` jiten dot a at gmail dot com
2004-07-11 10:00 ` jiten dot a at gmail dot com
2004-07-14 12:07 ` jakub at redhat dot com
2004-07-19 11:27 ` jakub at redhat dot com

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).