United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6704367 Stack sizes error with 1.5.0_14
JDK-6704367 : Stack sizes error with 1.5.0_14

Details
Type:
Bug
Submit Date:
2008-05-19
Status:
Closed
Updated Date:
2012-10-08
Project Name:
JDK
Resolved Date:
2008-09-22
Component:
hotspot
OS:
solaris_9
Sub-Component:
runtime
CPU:
sparc
Priority:
P2
Resolution:
Fixed
Affected Versions:
5.0u14
Fixed Versions:
5.0u16-rev (b10)

Related Reports
Backport:
Relates:
Relates:

Sub Tasks

Description
Stack size error thrown with 1.5.0_14. Customer experiences the problem after moving to
1.5.0_14

                                    

Comments
EVALUATION

Now, the problem figured out:

1) this problem cannot be produced with 6
2) reproduced with 5.0 the current verison (all versions defacto).

In 6, when thr_main() called in os::initialize_thread, it returns 0.
in 5, it returns 1.

The problem is if the current stack offset is bigger than 1 page (8192 bytes) then call:
page_align_size_down(current_stack_offset) will return 1 page size (8K), so next 

stack_size += page_align_size_down(current_stack_offset) will generate a size which is 1 page size bigger than the one speicified with -Xss8M. It will fail definitely.

In 6, thr_main return false, so it never triggers this part.
The better solution is that we don't add the current offset to the stack size, just align the specified stack size with page size.
                                     
2008-07-21
EVALUATION

The current stack offset which is used to align down stack size to multiple page size is different between success/failure cases: In success case, it is less than 8K and in failed case, it is over 8K. The later led one more page size added to stack size.

Since only a few solaris 9 sparc machines can reproduce so there could be libthread difference since the stack offset change over 1 page size for same example code. 

With 6316197, a separate thread created to launch JVM so -Xss<size> or -XX:ThreadStackSize=<size> will not be applied to main thread. For java thread, that means the failed code which should be exclusively for main thread will not be called and this problem is solved.
                                     
2008-07-22
WORK AROUND

unset unused environmental variables.
                                     
2008-07-25
EVALUATION

when process java launched, system forks a process and put user environment variables on the stack. The size of the stack used depends on the size of environment variables. In the failure case, the size of stack used for user environmental variables exceeds 1 page (8K). The stack size is set to stack limit, for main thread, after this used page(s) add to specified stack size, the total size is bigger than stack limit.

One workaround is reduce size of environmental variables.

Fix give a warning of "main thread will have %dK less stack" instead of exit.
                                     
2008-07-25



Hardware and Software, Engineered to Work Together