Re: stack size to small?
Hui Huang <[email protected]>
| Newsgroups | gmane.comp.java.linux.general |
|---|---|
| Message-ID | <[email protected]> |
The alt stack is allocated during thread creation. OutOfMemoryError might be a better choice than outright fatal. But keep in mind OutOfMemoryError is already very generic, it's not so easy to figure out what actually caused the OOM. Like I said, a better fix is to not use alt stack at all. It is implemented in 1.5. thanks, -hui Joseph Shraibman wrote: > This alt stack is allocated when? I'm confused. If at thread creation, > then the thread.start() should fail with an OutOfMemError. If it is > allocated when a stack overflow occurs, well of course there won't be > space to allocate the alt stack because we just had a stack overflow > > Hui Huang wrote: > >> JVM fataled because it's an irrecoverable error (i.e. not as >> simple as StackOverflowError). >> >> Prior to 1.5, Sun's JDK needs to allocate alternate signal stack >> to handle stack overflows. For compatibility reasons, the alt >> stack is actually allocated within the normal thread stack. If a >> thread (either a pure Java thread or a native thread attached to >> VM) does not have enough stack space for the alt stack, JVM will >> have to abort (JVM can't continue because signal handlers have >> already been set up to use alternate signal stack; each thread >> must have its own alt stack, if any thread is missing alt stack, >> you'll end up having two threads sharing the stack space, which >> will lead to crashes that are much harder to diagnose). >> >> Alt signal stacks have been removed in 1.5. I'd recommend you to >> try JDK 1.5-beta, which is available at java.sun.com. You might >> also want to check your code (both Java and native) to see if >> you are creating threads with small stack. Before 1.5, the minimum >> stack size allowed is 96k. >> >> regards, >> -hui >> >> Joseph Shraibman wrote: >> >>> That's what StackOverflowError is for. It shouldn't crash the jvm >>> >>> Dan Kegel wrote: >>> >>>> Joseph Shraibman wrote: >>>> >>>>> I had a jvm running for a few hours when it suddenly quit with: >>>>> >>>>> Fatal: Stack size too small. Use 'java -Xss' to increase default >>>>> stack size. >>>>> >>>>> >>>>> WTF? >>>> >>>> >>>> >>>> >>>> >>>> Maybe you allocated something huge on the stack, or had >>>> too many levels of nested calls... >>>> >>> >>> >>> ---------------------------------------------------------------------- >>> To UNSUBSCRIBE, email to [email protected] >>> with a subject of "unsubscribe". Trouble? Contact [email protected] >>> >> > ---------------------------------------------------------------------- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]