[ 
https://issues.apache.org/jira/browse/IGNITE-24323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17922026#comment-17922026
 ] 

Aleksey Plekhanov commented on IGNITE-24323:
--------------------------------------------

Implementation details:
Regular {{IgniteThreadPoolExecutor}} is used instead of striped pool executor. 
But with custom {{BlockingQueue}}. This blocking queue implemented as wrapper 
over the new data structure {{QueryTasksQueue}}. On {{poll}} from this queue 
query is blocked by ID and no more task with the same query ID can be polled 
until query is unblocked explicitely. Query is unblocked in {{finally}} block 
after the task completes execution. So no tasks can be executed concurrently 
for the same query and we still provide initial tasks ordering in scope of one 
query.   

> Calcite engine. Query execution inside UDF leads to deadlock
> ------------------------------------------------------------
>
>                 Key: IGNITE-24323
>                 URL: https://issues.apache.org/jira/browse/IGNITE-24323
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Aleksey Plekhanov
>            Assignee: Aleksey Plekhanov
>            Priority: Major
>              Labels: calcite, ise
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> We have striped executor to execute query tasks. Thread for query/fragment on 
> each node is fixed and defined by hash of query ID and fragment ID. If user 
> created user defined function and try to execute some query inside it, it can 
> lead to deadlock, since task execution thread blocked by new synchronous 
> query execution request and the new query can be assigned to the same thread.
> For H2-based SQL engine threads are no binded to the query and there is no 
> such problem.
> For Calcite-based SQL engine we use non thread safe datastructures in tasks. 
> To workaround this problem we can use regular IgniteThreadPoolExecutor, but 
> need to ensure that there are no tasks concurrently executing for the same 
> query/fragment.
> Also, perhaps this approach can affect performance and should be enabled by 
> some property explicitly only for users that require this mode. 
>   



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to