- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Bus error in thread program
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-08-2002 10:48 PM
тАО01-08-2002 10:48 PM
The following is simple thread program. But it receives Bus erorr and creates core.
#include
#include
#define THREAD_NUM 1
#define MAX_STRING_SIZE 64 * 1024
void* foo(void* arg) {
char data[MAX_STRING_SIZE];
bzero(data, sizeof(data));
return;
}
int main() {
int i;
pthread_t threadId[16];
if (THREAD_NUM > 0) {
for (i = 0; i < THREAD_NUM; i++)
pthread_create(&threadId[i], NULL, foo, NULL);
for (i = 0; i < THREAD_NUM; i++)
pthread_join(threadId[i], NULL);
}
else
foo(NULL);
}
When I decrese MAX_STRING_SIZE to 32K or run without thread, it runs successfully. How do you think I could resolve this?
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-09-2002 12:22 AM
тАО01-09-2002 12:22 AM
Re: Bus error in thread program
Would help to know
1)OS
2)Compiler Version
3)Patch Level - Certainly shells and libs
4)Compile options.
5)The output of
file core
on one of the core files generated and the
exacr=t bus error.
However looking in the latest C++ patches I find
increase maximum string literal length from
8 to 32K
You are probably hitting that.
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-09-2002 12:43 AM
тАО01-09-2002 12:43 AM
Re: Bus error in thread program
1)OS: HP-UX 11.0
2)Compiler Version: B.11.01.20(C/ANSI C Developer's Bundle for HP-UX 11.00)
3)Patch Level
- B.11.00.53.2 HP-UX General Release Patches, June 2001
- B.11.00.51.2 HP-UX Hardware Enablement and Critical Patches, December 2000
4)Compile options.
cc -o thr thr.c -lpthread
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-09-2002 01:14 AM
тАО01-09-2002 01:14 AM
Re: Bus error in thread program
If you are missing any of these patches add them
hp-ux_patches/s700_800/11.X/PHSS_25171
hp-ux_patches/s700_800/11.X/PHSS_25249
hp-ux_patches/s700_800/11.X/PHCO_25707
hp-ux_patches/s700_800/11.X/PHCO_23963
hp-ux_patches/s700_800/11.X/PHKL_18543
hp-ux_patches/s700_800/11.X/PHCO_23651
hp-ux_patches/s700_800/11.X/PHCO_21187
hp-ux_patches/s700_800/11.X/PHKL_24116
hp-ux_patches/s700_800/11.X/PHKL_24027
hp-ux_patches/s700_800/11.X/PHKL_20016
hp-ux_patches/s700_800/11.X/PHKL_22589
hp-ux_patches/s700_800/11.X/PHKL_23226
hp-ux_patches/s700_800/11.X/PHKL_22677
hp-ux_patches/s700_800/11.X/PHSS_24381
hp-ux_patches/s700_800/11.X/PHSS_24832
hp-ux_patches/s700_800/11.X/PHSS_24301
hp-ux_patches/s700_800/11.X/PHSS_24303
Also
What is the exact bus error and the output
of file core
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-09-2002 01:25 AM
тАО01-09-2002 01:25 AM
Re: Bus error in thread program
The output of "> file core" is
core: core file from 'thr'
But I don't know what "exact bus error" is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-09-2002 02:11 AM
тАО01-09-2002 02:11 AM
Solution#include
#include
int main() {
size_t stacksize;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &stacksize);
printf("stacksize = %d\n", stacksize);
}
$ gcc thrstack.c -o thrstack -lpthread
$ ./thrstack
stacksize = 65536
- allocate memory off the heap with malloc() instead of using the stack.
- change the default thread stack size attribute with pthread_attr_setstacksize(). Refer to the man page for details.
Regards,
Steve