[
https://issues.apache.org/jira/browse/UIMA-2515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13536056#comment-13536056
]
Marshall Schor commented on UIMA-2515:
--------------------------------------
This problem was analyzed by the support team, and they determined it was a
true out of stack space error. What happened, was the initial stack frame size
was of some value, but after JIT happened, each frame was expanded to hold more
values. So, although the initial calls to sort worked (that is, didn't run out
of stack space), after JITting, there wasn't enough stack space. The suggested
work-around is to increase the maximum stack space if this happens, by adding
the parameter -Xss500K (or some other value).
Note that increasing this value increases the virtual memory use for each
thread, so this can have an impact on the amount of memory consumed.
Another alternative is to switch to Java 7, which has a completely different
sort algorithm which appears not to use so much stack.
The current workaround (retrying 20 times) might or might not work (it worked
in the 1 case I tried). If it does work, it could fail for even larger sets of
strings.
Since in common use cases (?) many strings are identical, it may be better to
do an approach which:
1) puts all the strings into a hash set (thus eliminating dups)
2) sorts the result
This could be done only if a stack overflow error pops up, to avoid (in most
cases) the speed/space consequences.
> Need better workaround for intermittent out-of-stack in Arrays.sort for
> compressed binary serialization
> -------------------------------------------------------------------------------------------------------
>
> Key: UIMA-2515
> URL: https://issues.apache.org/jira/browse/UIMA-2515
> Project: UIMA
> Issue Type: Bug
> Components: Core Java Framework
> Affects Versions: 2.4.0SDK
> Environment: Windows, Linux, IBM Java 5 and 6 (not 7, not Sun/Oracle)
> Reporter: Marshall Schor
> Assignee: Marshall Schor
> Fix For: 2.4.1SDK
>
>
> On IBM Java 6, there is an occasional failure in Arrays.sort used to sort the
> strings in the heap. The failure is an out-of-stack-space error. It is very
> intermittent. I had earlier seen this, and had wrapped the call to
> Arrays.sort in a try/catch loop which caught the out-of-stack-space. The
> code would retry this once, after reversing the array (thinking this would
> change things to avoid the out-of-memory). In further extensive use, this
> error has popped up again, even with this retry. Need a better workaround.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira