Hi Buddy,
> If we attempt to execute it again (sometimes twice, but have done so
> repeatedly up to 5 times), the error goes away and all is fine.
Difficult to say why this happens. Maybe your code is rewritten by
Java’s JIT compiler.
> Is there anything you can suggest or anything we can provide you to see how
> to eliminate this. This is particularly problematic on our server when we
> reboot our production application.
> Anything you can suggest or anyway we can help is much appreciated.
The problem itself is a generic one and not limited to BaseX or
XQuery. Did you try rewrite your function calls to tail calls [1]?
Another alternative is to increase the stack size of Java (via the
-Xss flag).
Hope this helps,
Christian
[1]
https://en.wikipedia.org/wiki/Tail_call