Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
8303549: [AIX] TestNativeStack.java is failing with exit value 1
Browse files Browse the repository at this point in the history
Reviewed-by: mbaesken
Backport-of: 5ff42d14294199eb3bf10b66530f9249fb68810d
  • Loading branch information
RealCLanger committed Aug 3, 2023
1 parent 20ca046 commit f87a70d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Expand Up @@ -89,14 +89,19 @@ void *thread_runner(void *threadid) {

int main (int argc, char* argv[]) {
pthread_t threads[NUM_THREADS];
pthread_attr_t attr;
pthread_attr_init(&attr);
size_t stack_size = 0x100000;
pthread_attr_setstacksize(&attr, stack_size);
for (int i = 0; i < NUM_THREADS; i++ ) {
printf("[*] Creating thread %d\n", i);
int status = pthread_create(&threads[i], NULL, thread_runner, (void *)(intptr_t)i);
int status = pthread_create(&threads[i], &attr, thread_runner, (void *)(intptr_t)i);
if (status != 0) {
printf("[*] Error creating thread %d - %d\n", i, status);
exit(-1);
}
}
pthread_attr_destroy(&attr);
for (int i = 0; i < NUM_THREADS; i++ ) {
pthread_join(threads[i], NULL);
}
Expand Down
9 changes: 8 additions & 1 deletion test/hotspot/jtreg/runtime/jni/nativeStack/libnativeStack.c
Expand Up @@ -109,11 +109,18 @@ Java_TestNativeStack_triggerJNIStackTrace

warning = warn;

if ((res = pthread_create(&thread, NULL, thread_start, NULL)) != 0) {
pthread_attr_t attr;
pthread_attr_init(&attr);
size_t stack_size = 0x100000;
pthread_attr_setstacksize(&attr, stack_size);

if ((res = pthread_create(&thread, &attr, thread_start, NULL)) != 0) {
fprintf(stderr, "TEST ERROR: pthread_create failed: %s (%d)\n", strerror(res), res);
exit(1);
}

pthread_attr_destroy(&attr);

if ((res = pthread_join(thread, NULL)) != 0) {
fprintf(stderr, "TEST ERROR: pthread_join failed: %s (%d)\n", strerror(res), res);
exit(1);
Expand Down

1 comment on commit f87a70d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.