RFR(XS): 8204652: [aix] fix thread stack allocation, too big stack sizes not recognized

Thomas Stüfe thomas.stuefe at gmail.com
Mon Jun 11 09:40:53 UTC 2018


On Mon, Jun 11, 2018 at 10:35 AM, David Holmes <david.holmes at oracle.com> wrote:
<snip>

>> As we know linux is bad at implementing the pthread functionality here:
>> It accepts setting the big value as stack size, and only when you call
>> create
>> you get the failure.
>
>
> Does POSIX require otherwise?

No. Since pthread_attr_setstacksize() and pthread_create() happen at
different times, the memory situation may be different at thread
creation time, so any check for available memory done at
pthread_attr_setstacksize() time is of course incomplete.

Of course the OS could weed out obvious bogus values when
pthread_attr_setstacksize() is called. But it is not required to do
so.

But I talked this over with Goetz offline - I think to be correct, one
would have to handle error returns from pthread_attr_setstacksize() on
Linux too. The fact that the glibc allows any silly stack size to be
set at that point is a glibc implementation detail, and may e.g.
change when compiling with a different libc.

But that is not urgent.

<snip>

..Thomas


More information about the hotspot-runtime-dev mailing list