Can someone elaborate on this sentence in the documentation about jobs:result:
“Please note that this query can easily cause a deadlock if the asynchronously executed query will be queued. “
Referring to this example:
let $query := jobs:eval('(1 to 10000000)[. = 1]', map{}, map{ 'cache': true() }) return ( jobs:wait($query), jobs:result($query) )
And this about jobs:wait
“If the function is called with the id of a queued job, or repeatedly executed job, it may stall and never terminate.”
Can jobs:eval above be queued before jobs:wait is evaluated within the let expression?
Kendall
Hi Kendall,
Can someone elaborate on this sentence in the documentation about jobs:result:
I hope that the updated documentation contains the missing pieces of the jigsaw [1,2]:
Please note that queries of this kind can cause deadlocks. For example, if both the original query and the query to be executed asynchronously perform updates on the same database, the second query would only be run after the first one has been executed, and the first query will wait forever.
The function will terminate immediately if the job id is unknown. This is the case if a future job has not been queued yet, or if the id has already been discarded after job evaluation.
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Jobs_Module#jobs:result [2] http://docs.basex.org/wiki/Jobs_Module#jobs:wait
basex-talk@mailman.uni-konstanz.de