RFR(S): 8186293: [aix] Fix thread creation with huge stack sizes
Thomas Stüfe
thomas.stuefe at gmail.com
Thu Aug 17 07:07:18 UTC 2017
On Thu, Aug 17, 2017 at 8:52 AM, Lindenmaier, Goetz <
goetz.lindenmaier at sap.com> wrote:
> Hi David,
>
> > I wonder whether a fatal error "Error occurred during initialization of
> > VM" would not be better than just logging a warning?
> I skip thread creation if the error code is != 0 and return false as it
> happens on linux. So you see the exact same behavior. Only I
> print the additional message about the stack size because that
> is missing from the pthread attr which is reported (as setting it
> failed).
>
Platforms seem to have different behaviour now:
AIX debug (with your patch): if either one of pthread_attr_setstacksize(),
pthread_attr_setguardsize or pthread_create fails, we log a warning and
return an error.
AIX release: ditto.
Linux debug: if pthread_attr_setstacksize fails, we assert. We ignore
errors from pthread_attr_setguardsize. If pthread_create fails, we log a
warning and return an error.
Linux release: We ignore errors from both pthread_attr_setstacksize and
pthread_attr_setguardsize. If pthread_create fails, we log a warning and
return an error.
I think it would be nice to have consistent behavior for all platforms. Not
sure if this needs to be done with this patch here. As for an "Error
occurred during initialization" (debug only or release too?) - can we be
sure this only happens at initialization? Could it not be possible for java
threads with different stack sizes to be started later, and triggering the
same error?
I think I prefer to always have a runtime error (both in debug and release
builds), as Goetz did in his current AIX patch. And maybe have a sensible
Exception text.
Kind Regards, Thomas
>
> I removed the reference to linux, although I find it useful to
> point out such unexpected differences.
> http://cr.openjdk.java.net/~goetz/wr17/8186293-aixHugeStack/webrev.02/
>
> Best regards,
> Goetz.
>
>
>
>
> > -----Original Message-----
> > From: David Holmes [mailto:david.holmes at oracle.com]
> > Sent: Wednesday, August 16, 2017 10:54 PM
> > To: Lindenmaier, Goetz <goetz.lindenmaier at sap.com>; hotspot-runtime-
> > dev at openjdk.java.net
> > Subject: Re: RFR(S): 8186293: [aix] Fix thread creation with huge stack
> sizes
> >
> > On 17/08/2017 12:24 AM, Lindenmaier, Goetz wrote:
> > > Hi,
> > >
> > > TestOptionWithRanges causes the vm on aix to crash on some machines.
> > > This is because huge stack sizes are not treated properly.
> > >
> > > On linux, pthread_attr_setstacksize succeeds if called with huge
> values, but
> > > pthread_create() then fails. On Aix, pthread_attr_setstacksize fails
> if
> > > passed a value exceeding the limits and leaves the minimal system
> >
> > The AIX behaviour is more in spirit with POSIX.
> >
> > > thread stack size in attr. Thus thread creation succeeds and leads to
> > > crashes after thread creation when the guard pages shall be protected
> > > but don't fit on the tiny stack created.
> > >
> > > Please review this small, aix-only change.
> > > http://cr.openjdk.java.net/~goetz/wr17/8186293-
> > aixHugeStack/webrev.01/
> >
> > I wonder whether a fatal error "Error occurred during initialization of
> > VM" would not be better than just logging a warning?
> >
> > As Thomas notes, no need to discuss/describe what may or may not happen
> > on other platforms.
> >
> > Cheers,
> > David
> >
> > > Best regards,
> > > Goetz.
> > >
>
More information about the hotspot-runtime-dev
mailing list