Repository navigation
Commit d1d0462
fix(connection): don't block in set_query_timeout() while a query runs
The engine applies the query timeout and the per-query thread limit under the
same per-connection lock that a running query holds for its whole duration.
Connection.set_query_timeout() and set_max_threads_for_exec() called the
engine right away, so with a query running on the connection they blocked
until it finished. On the pybind backend they also held the GIL while waiting,
which froze every Python thread, including an asyncio event loop that called
AsyncConnection.set_query_timeout().
Both setters now record the value and return immediately. The value is
applied before the next execute(), query_as_arrow() or Arrow-table call on
that connection, by one thread at a time so that the latest value wins. The
pybind bindings of the two native setters release the GIL, so a thread that
does wait for the lock does not stall other threads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 0738739 commit d1d0462
3 files changed
Lines changed: 100 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
414 | 418 | | |
415 | 419 | | |
416 | 420 | | |
| |||
464 | 468 | | |
465 | 469 | | |
466 | 470 | | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
467 | 474 | | |
468 | 475 | | |
469 | 476 | | |
470 | 477 | | |
471 | 478 | | |
472 | 479 | | |
473 | 480 | | |
474 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
475 | 492 | | |
476 | 493 | | |
477 | 494 | | |
| |||
975 | 992 | | |
976 | 993 | | |
977 | 994 | | |
| 995 | + | |
978 | 996 | | |
979 | 997 | | |
980 | 998 | | |
| |||
1068 | 1086 | | |
1069 | 1087 | | |
1070 | 1088 | | |
| 1089 | + | |
1071 | 1090 | | |
1072 | 1091 | | |
1073 | 1092 | | |
| |||
1186 | 1205 | | |
1187 | 1206 | | |
1188 | 1207 | | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
1189 | 1211 | | |
1190 | 1212 | | |
1191 | 1213 | | |
| |||
1194 | 1216 | | |
1195 | 1217 | | |
1196 | 1218 | | |
1197 | | - | |
| 1219 | + | |
| 1220 | + | |
1198 | 1221 | | |
1199 | 1222 | | |
1200 | 1223 | | |
| |||
1317 | 1340 | | |
1318 | 1341 | | |
1319 | 1342 | | |
| 1343 | + | |
1320 | 1344 | | |
1321 | 1345 | | |
1322 | 1346 | | |
| |||
1350 | 1374 | | |
1351 | 1375 | | |
1352 | 1376 | | |
| 1377 | + | |
1353 | 1378 | | |
1354 | 1379 | | |
1355 | 1380 | | |
| |||
1411 | 1436 | | |
1412 | 1437 | | |
1413 | 1438 | | |
| 1439 | + | |
1414 | 1440 | | |
1415 | 1441 | | |
1416 | 1442 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
3 | 9 | | |
4 | 10 | | |
5 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
6 | 15 | | |
7 | 16 | | |
8 | 17 | | |
| |||
11 | 20 | | |
12 | 21 | | |
13 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
0 commit comments