Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - crash under 6.3.2 but not 6.4.1: (6 Items)
   
crash under 6.3.2 but not 6.4.1  
The following program will crash under 6.3.2.  The backtrace always looks like:

_list_release()
_prelocked_free()
__free()
free()
delete()
~facet() xlocale
~locale() xlocale
std::basic_ios<char.....> widen(char) 
endl<....>


#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sstream>
#include <pthread.h>

#define NUM 4

bool dye = false;
int count=0;

void *spitOutThread(void *arg)
{
	std::stringstream  myStream;
		
	try
	{
		for(;dye != true ;)
		{
			myStream << "this is a test" << std::endl;
			myStream.str("");
			++count; 
			
		}
	}
	catch (...)
	{
		printf("What?\n");
	}
	
	return NULL;
}


int main(void) {

	int id[NUM];
	
	for( int i=0; i< NUM; ++i)
			pthread_create( &id[i], NULL, spitOutThread, NULL );
		
	sleep(5);
	
	dye = true;
	
	sleep(1);
	
	return 0;
}

	


Re: crash under 6.3.2 but not 6.4.1  
> The following program will crash under 6.3.2.  The backtrace always looks like
> :
> 
> _list_release()
> _prelocked_free()
> __free()
> free()
> delete()
> ~facet() xlocale
> ~locale() xlocale
> std::basic_ios<char.....> widen(char) 
> endl<....>
> 
I run the test program on a quad core machine.  If I limit it to one core with on -C1 it doesn't crash.  As a matter of 
fact it seems it will only crash if it's allowed to use all for cores.


Re: crash under 6.3.2 but not 6.4.1  
Mario Charest wrote:
> I run the test program on a quad core machine.  If I limit it to one core with on -C1 it doesn't crash.  As a matter 
of fact it seems it will only crash if it's allowed to use all for cores.
> 

Interesting. Have you always used the same level of 
optimization? I am curious if compiling with -O0 would make 
crash go away (on quad core machine)?


---
Aleksandar
RE: crash under 6.3.2 but not 6.4.1  

> -----Original Message-----
> From: Aleksandar Ristovski [mailto:community-noreply@qnx.com]
> Sent: June-19-09 12:16 PM
> To: general-toolchain
> Subject: Re: crash under 6.3.2 but not 6.4.1
> 
> Mario Charest wrote:
> > I run the test program on a quad core machine.  If I limit it to one
> core with on -C1 it doesn't crash.  As a matter of fact it seems it
> will only crash if it's allowed to use all for cores.
> >
> 
> Interesting. Have you always used the same level of
> optimization? I am curious if compiling with -O0 would make
> crash go away (on quad core machine)?

I tried -O0  (cc main.cpp -ostream) no difference which isn't a big surprise given that the same executable runs fine on
 6.4.1. That tells me it's a library issue.

> 
> 
> ---
> Aleksandar
> 
> 
> _______________________________________________
> General
> http://community.qnx.com/sf/go/post32137
> 
Re: RE: crash under 6.3.2 but not 6.4.1  
> 
> 
> > -----Original Message-----
> > From: Aleksandar Ristovski [mailto:community-noreply@qnx.com]
> > Sent: June-19-09 12:16 PM
> > To: general-toolchain
> > Subject: Re: crash under 6.3.2 but not 6.4.1
> > 
> > Mario Charest wrote:
> > > I run the test program on a quad core machine.  If I limit it to one
> > core with on -C1 it doesn't crash.  As a matter of fact it seems it
> > will only crash if it's allowed to use all for cores.
> > >
> > 
> > Interesting. Have you always used the same level of
> > optimization? I am curious if compiling with -O0 would make
> > crash go away (on quad core machine)?
> 
> I tried -O0  (cc main.cpp -ostream) no difference which isn't a big surprise 
> given that the same executable runs fine on 6.4.1. That tells me it's a 
> library issue.
> 

For anyone interested:  the problem seems to be in the library because if the code is compile with the gpp lib it 
doesn't crash.  


> > 
> > 
> > ---
> > Aleksandar
> > 
> > 
> > _______________________________________________
> > General
> > http://community.qnx.com/sf/go/post32137
> > 


Re: crash under 6.3.2 but not 6.4.1  
> The following program will crash under 6.3.2.  The backtrace always looks like
> :

I created TicketID88754 through standard support.

> 
> _list_release()
> _prelocked_free()
> __free()
> free()
> delete()
> ~facet() xlocale
> ~locale() xlocale
> std::basic_ios<char.....> widen(char) 
> endl<....>
> 
> 
> #include <string.h>
> #include <stdio.h>
> #include <unistd.h>
> #include <sstream>
> #include <pthread.h>
> 
> #define NUM 4
> 
> bool dye = false;
> int count=0;
> 
> void *spitOutThread(void *arg)
> {
> 	std::stringstream  myStream;
> 		
> 	try
> 	{
> 		for(;dye != true ;)
> 		{
> 			myStream << "this is a test" << std::endl;
> 			myStream.str("");
> 			++count; 
> 			
> 		}
> 	}
> 	catch (...)
> 	{
> 		printf("What?\n");
> 	}
> 	
> 	return NULL;
> }
> 
> 
> int main(void) {
> 
> 	int id[NUM];
> 	
> 	for( int i=0; i< NUM; ++i)
> 			pthread_create( &id[i], NULL, spitOutThread, NULL );
> 		
> 	sleep(5);
> 	
> 	dye = true;
> 	
> 	sleep(1);
> 	
> 	return 0;
> }
> 
> 	
> 
>