Hi Christian,

>I’m somewhat sorry this bug is fixed now
Me too :)

> As we can’t assess at compile time if locking is necessary.
I guess there are two compile times at play here, as with xquery-eval.
It would be nice to find a way to downgrade locks as well as upgrade them.
But easier said than done.

/Andy





On Mon, 13 Jun 2022 at 12:17, Christian Grün <christian.gruen@gmail.com> wrote:
Hi Andy,

> I am pretty sure this is a bug/oversight in inspect:functions. I suspect running it risks data integrity, so it is not a good idea.

Good catch; and I’m somewhat sorry this bug is fixed now [1]. As we
can’t assess at compile time if locking is necessary, a global read
lock is now applied as soon as the function is called. The read lock
is upgraded to a write lock if one of the returned functions is
invoked as an updating function.

Cheers,
Christian

[1] https://github.com/BaseXdb/basex/commit/8e6ae0d02188348b7b8adb872657fc700518675b