RFR(xs): 8187028: [aix] Real thread stack size may be up to 64K smaller than requested one

Thomas Stüfe thomas.stuefe at gmail.com
Thu Aug 31 17:43:38 UTC 2017


Hi Goetz,

thank you for your review.

New Webrev:
http://cr.openjdk.java.net/~stuefe/webrevs/8187028-aix-Real-thread-stack-size-may-be-up-to-64K-smaller-than-requested-one/webrev.01/webrev/

Please find comments inline.

On Thu, Aug 31, 2017 at 3:54 PM, Lindenmaier, Goetz <
goetz.lindenmaier at sap.com> wrote:

> Hi Thomas,
>
>
>
> is it possible that AIX takes the os guard pages out of the stack in your
> case?
>
> But if I remember correctly, AIX added them to the size of the stack
> correctly,
>
> linux has non-standard behavior, see also create_thread in os_linux.cpp.
>
>
>

For several reasons I do not believe that is the case here. Among others,
we set the guard page size at 4K so even if the OS deducts that from our
stack size, it does not explain deltas of up to 64K.


> Instead of thread->stack_base() - thread->stack_size(); please use
> stack_end().
>
>
>

Fixed.


> Did you check this does not break the stack sizing tests? I think they
> start the
>
> VM with small stacks and expect the VM not to start up. Now it might start
>
> up if the bug is not on that platform because the stack is 64K bigger than
>
> expected.
>
>
>

I changed to fix to only buff the thread stack size up for smaller thread
stacks, to avoid running into overflow scenarios. As for too small stacks,
I do not think it can be helped much. If these tests break, they should be
adjusted, but they should not prevent this very reasonable fix.

Also, in the light of this bug, I do not think they can be made bullet
proof. If the OS randomly hands out stack sizes which differ by as much as
64K, it is very difficult to precisely predict at which stack size stack
overflows are going to happen and which size is still okay.

Please note that there is a wee bit of a time factor here, as jdk10/hs will
close tomorrow for the next n weeks and I have vacations upcoming. I do not
want to rush you. If you have objections, we will take time to address
them, but the fix will have to wait until October if it is not pushed
tomorrow.

Cheers, Thomas


> Best regards,
>
>   Goetz.
>
>
>
>
>
>
>
>
>
> *From:* ppc-aix-port-dev [mailto:ppc-aix-port-dev-bounces at openjdk.java.net]
> *On Behalf Of *Thomas Stüfe
> *Sent:* Thursday, August 31, 2017 12:09 PM
> *To:* ppc-aix-port-dev at openjdk.java.net
> *Subject:* RFR(xs): 8187028: [aix] Real thread stack size may be up to
> 64K smaller than requested one
>
>
>
> Hi all,
>
>
>
> please review this change:
>
>
>
> Bug:
>
> https://bugs.openjdk.java.net/browse/JDK-8187028
>
>
>
> change:
>
> http://cr.openjdk.java.net/~stuefe/webrevs/8187028-aix-
> Real-thread-stack-size-may-be-up-to-64K-smaller-than-
> requested-one/webrev.00/webrev/
>
>
>
> The issue is that on AIX, pthread library seems to have a bug where it
> sometimes gives us less thread stack space than we requested (a variable
> amount, but seems to be 0..64K). This may cause intermittent stack overflow
> errors if the stacks are very small to begin with.
>
>
>
> The workaround is to add 64K to the requested stack size to account for
> the fact that the OS may give us up to 64K less stack.
>
>
>
> Also, improved logging.
>
>
>
> Thanks, Thomas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/ppc-aix-port-dev/attachments/20170831/3f7f05c0/attachment.html>


More information about the ppc-aix-port-dev mailing list