Hi Marco,

It’s just an assumption, but your problem could be related to a known 
xquery:fork-join bug that became effective with BaseX 12.0 and JDK  17 [1]. We 
are working on it, but I cannot give a timeline yet.

You can try to minimize the code that is contained in the fork-join function. 
For example, code like…

xquery:fork-join(
  for $i in 1 to 100
  return fn() {
    let $url := "http://xyz.com/"; || $i
    return doc($url)
  }
)

…could be simplified to:

let $urls := (
  for $i in 1 to 100
  return "http://xyz.com/"; || $i
)
return xquery:fork-join(
  for $url in $urls
  return fn() { doc($url) }
)

Hope this helps; please follow the referenced GitHub issue to track the 
progress.
Christian

[1] https://github.com/BaseXdb/basex/issues/2479
________________________________
Von: Marco Lettere via BaseX-Talk <[email protected]>
Gesendet: Dienstag, 3. Februar 2026 10:29
An: [email protected] <[email protected]>
Betreff: [basex-talk] Re: Difficult for me to understand

Oops, forgot to mention that meanwhile I moved from 11.7 to 12.1.

Sorry.


On 03/02/26 10:18, Marco Lettere wrote:
> Hi Christian and all,
>
> I'm experiencing a weird issue with a RestXQ service of mine which was
> working and suddenly starts having problems because it just stops
> serving requests.
>
> I know about SSCE and so on but this time it's hard to reproduce.
> Shortly, it receives about 5 simultaneous requests and for each of
> those it calls one xquery:fork-join (5 functions) to query another
> service.
>
> I cannot say what the error is exactly during the time when it is
> stuck. What I can see on the client are, besides HTTP 503 and Read
> Timeouts, the following logs which appear frequently but with no
> particular order:
>
> ERROR: Unexpected error: java.lang.NullPointerException: Cannot invoke
> "org.basex.util.hash.WeakTokenSet$WeakTokenRef.get()" because
> "this.keys[index]" is null (hint:
> /...y/webapp/nubisware.muscle.fiber.ccp_admin/ccp_worker_sk.xqm@65:33)
>
> ERROR: Unexpected error: java.lang.ArrayIndexOutOfBoundsException
> (hint:
> /.../webapp/nubisware.muscle.fiber.ccp_admin/ccp_worker_sk.xqm@65:33)
>
> ERROR: Unexpected error: java.lang.ArrayIndexOutOfBoundsException:
> Index 8 out of bounds for length 8 (hint:
> /.../webapp/nubisware.muscle.fiber.ccp_admin/ccp_worker_sk.xqm@65:33)
>
> Line and column numbers point always to the same xquery:fork-join call.
>
> Can you point me to what I should investigate? Am I hitting some
> quantitative limit on concurrency? Connections?
>
> Thank you for any help because I'm currently wandering in the darkness
> :-)
>
> Regards,
>
> Marco.
>

Reply via email to