This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Commit 24d45d0
authored
fix: updates timeout/retry code to respect hanging server (#2408)
**Description**
This PR fixes a crash when handling `_InactiveRpcError` during retry
logic and ensures proper `timeout` propagation in
`RowIterator.to_dataframe`.
**Fixes**
**Retry Logic Crash**: Addressed an issue in
`google/cloud/bigquery/retry.py` where `_should_retry` would raise a
`TypeError` when inspecting unstructured `gRPC` errors (like
`_InactiveRpcError`). The fix adds robust error inspection to fallback
gracefully when `exc.errors` is not subscriptable.
**Timeout Propagation**: Added the missing `timeout` parameter to
`RowIterator.to_dataframe` in `google/cloud/bigquery/table.py`. This
ensures that the user-specified `timeout` is correctly passed down to
the underlying `to_arrow` call, preventing the client from hanging
indefinitely when the Storage API is unresponsive.
**Changes**
Modified `google/cloud/bigquery/retry.py`: Updated `_should_retry` to
handle `TypeError` and `KeyError` when accessing `exc.errors`.
Modified `google/cloud/bigquery/table.py`: Updated
`RowIterator.to_dataframe` signature and implementation to accept and
pass the `timeout` parameter.
The first half of this work was completed in PR #23541 parent 7b8ceea commit 24d45d0Copy full SHA for 24d45d0
File tree
Expand file treeCollapse file tree
9 files changed
+214
-17
lines changedOpen diff view settings
Filter options
- google/cloud/bigquery
- dbapi
- tests/unit
- job
Expand file treeCollapse file tree
9 files changed
+214
-17
lines changedOpen diff view settings
Collapse file
google/cloud/bigquery/_pandas_helpers.py
Copy file name to clipboardExpand all lines: google/cloud/bigquery/_pandas_helpers.py+40-9Lines changed: 40 additions & 9 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
33 | 33 | |
34 | 34 | |
35 | 35 | |
| 36 | + |
36 | 37 | |
37 | 38 | |
38 | 39 | |
| ||
740 | 741 | |
741 | 742 | |
742 | 743 | |
743 | | - |
| 744 | + |
744 | 745 | |
745 | 746 | |
746 | 747 | |
| ||
751 | 752 | |
752 | 753 | |
753 | 754 | |
| 755 | + |
| 756 | + |
| 757 | + |
| 758 | + |
754 | 759 | |
755 | 760 | |
756 | 761 | |
| ||
759 | 764 | |
760 | 765 | |
761 | 766 | |
762 | | - |
763 | | - |
| 767 | + |
| 768 | + |
| 769 | + |
| 770 | + |
| 771 | + |
| 772 | + |
| 773 | + |
| 774 | + |
| 775 | + |
| 776 | + |
764 | 777 | |
765 | 778 | |
766 | 779 | |
| ||
778 | 791 | |
779 | 792 | |
780 | 793 | |
781 | | - |
| 794 | + |
782 | 795 | |
783 | 796 | |
784 | 797 | |
| ||
792 | 805 | |
793 | 806 | |
794 | 807 | |
| 808 | + |
| 809 | + |
| 810 | + |
| 811 | + |
795 | 812 | |
796 | 813 | |
797 | 814 | |
798 | 815 | |
799 | 816 | |
800 | 817 | |
801 | | - |
802 | | - |
| 818 | + |
| 819 | + |
| 820 | + |
| 821 | + |
| 822 | + |
| 823 | + |
| 824 | + |
| 825 | + |
| 826 | + |
| 827 | + |
| 828 | + |
803 | 829 | |
804 | 830 | |
805 | 831 | |
| ||
928 | 954 | |
929 | 955 | |
930 | 956 | |
| 957 | + |
931 | 958 | |
932 | 959 | |
933 | 960 | |
| ||
944 | 971 | |
945 | 972 | |
946 | 973 | |
| 974 | + |
| 975 | + |
| 976 | + |
| 977 | + |
947 | 978 | |
948 | 979 | |
949 | 980 | |
950 | 981 | |
| 982 | + |
| 983 | + |
951 | 984 | |
952 | 985 | |
953 | 986 | |
| ||
983 | 1016 | |
984 | 1017 | |
985 | 1018 | |
986 | | - |
987 | | - |
988 | 1019 | |
989 | 1020 | |
990 | 1021 | |
| ||
1006 | 1037 | |
1007 | 1038 | |
1008 | 1039 | |
1009 | | - |
| 1040 | + |
1010 | 1041 | |
1011 | 1042 | |
1012 | 1043 | |
|
Collapse file
google/cloud/bigquery/dbapi/cursor.py
Copy file name to clipboardExpand all lines: google/cloud/bigquery/dbapi/cursor.py+2Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
323 | 323 | |
324 | 324 | |
325 | 325 | |
| 326 | + |
| 327 | + |
326 | 328 | |
327 | 329 | |
328 | 330 | |
|
Collapse file
google/cloud/bigquery/retry.py
Copy file name to clipboardExpand all lines: google/cloud/bigquery/retry.py+11-5Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
12 | 12 | |
13 | 13 | |
14 | 14 | |
| 15 | + |
| 16 | + |
15 | 17 | |
16 | 18 | |
17 | 19 | |
18 | 20 | |
19 | 21 | |
20 | 22 | |
| 23 | + |
21 | 24 | |
22 | 25 | |
23 | 26 | |
| ||
61 | 64 | |
62 | 65 | |
63 | 66 | |
64 | | - |
65 | | - |
| 67 | + |
| 68 | + |
66 | 69 | |
67 | | - |
68 | | - |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
69 | 76 | |
70 | 77 | |
71 | | - |
72 | 78 | |
73 | 79 | |
74 | 80 | |
|
Collapse file
google/cloud/bigquery/table.py
Copy file name to clipboardExpand all lines: google/cloud/bigquery/table.py+5-1Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2152 | 2152 | |
2153 | 2153 | |
2154 | 2154 | |
2155 | | - |
| 2155 | + |
| 2156 | + |
| 2157 | + |
| 2158 | + |
2156 | 2159 | |
2157 | 2160 | |
2158 | 2161 | |
| ||
2366 | 2369 | |
2367 | 2370 | |
2368 | 2371 | |
| 2372 | + |
2369 | 2373 | |
2370 | 2374 | |
2371 | 2375 | |
|
Collapse file
tests/unit/job/test_query_pandas.py
Copy file name to clipboardExpand all lines: tests/unit/job/test_query_pandas.py+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
179 | 179 | |
180 | 180 | |
181 | 181 | |
| 182 | + |
| 183 | + |
182 | 184 | |
183 | 185 | |
184 | 186 | |
| ||
593 | 595 | |
594 | 596 | |
595 | 597 | |
| 598 | + |
| 599 | + |
596 | 600 | |
597 | 601 | |
598 | 602 | |
| ||
644 | 648 | |
645 | 649 | |
646 | 650 | |
| 651 | + |
| 652 | + |
647 | 653 | |
648 | 654 | |
649 | 655 | |
|
Collapse file
tests/unit/test__pandas_helpers.py
Copy file name to clipboardExpand all lines: tests/unit/test__pandas_helpers.py+131Lines changed: 131 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2252 | 2252 | |
2253 | 2253 | |
2254 | 2254 | |
| 2255 | + |
| 2256 | + |
| 2257 | + |
| 2258 | + |
| 2259 | + |
| 2260 | + |
| 2261 | + |
| 2262 | + |
| 2263 | + |
| 2264 | + |
| 2265 | + |
| 2266 | + |
| 2267 | + |
| 2268 | + |
| 2269 | + |
| 2270 | + |
| 2271 | + |
| 2272 | + |
| 2273 | + |
| 2274 | + |
| 2275 | + |
| 2276 | + |
| 2277 | + |
| 2278 | + |
| 2279 | + |
| 2280 | + |
| 2281 | + |
| 2282 | + |
| 2283 | + |
| 2284 | + |
| 2285 | + |
| 2286 | + |
| 2287 | + |
| 2288 | + |
| 2289 | + |
| 2290 | + |
| 2291 | + |
| 2292 | + |
| 2293 | + |
| 2294 | + |
| 2295 | + |
| 2296 | + |
| 2297 | + |
| 2298 | + |
| 2299 | + |
| 2300 | + |
| 2301 | + |
| 2302 | + |
| 2303 | + |
| 2304 | + |
| 2305 | + |
| 2306 | + |
| 2307 | + |
| 2308 | + |
| 2309 | + |
| 2310 | + |
| 2311 | + |
| 2312 | + |
| 2313 | + |
| 2314 | + |
| 2315 | + |
| 2316 | + |
| 2317 | + |
| 2318 | + |
| 2319 | + |
| 2320 | + |
| 2321 | + |
| 2322 | + |
| 2323 | + |
| 2324 | + |
| 2325 | + |
| 2326 | + |
| 2327 | + |
| 2328 | + |
| 2329 | + |
| 2330 | + |
| 2331 | + |
| 2332 | + |
| 2333 | + |
| 2334 | + |
| 2335 | + |
| 2336 | + |
| 2337 | + |
| 2338 | + |
| 2339 | + |
| 2340 | + |
| 2341 | + |
| 2342 | + |
| 2343 | + |
| 2344 | + |
| 2345 | + |
| 2346 | + |
| 2347 | + |
| 2348 | + |
| 2349 | + |
| 2350 | + |
| 2351 | + |
| 2352 | + |
| 2353 | + |
| 2354 | + |
| 2355 | + |
| 2356 | + |
| 2357 | + |
| 2358 | + |
| 2359 | + |
| 2360 | + |
| 2361 | + |
| 2362 | + |
| 2363 | + |
| 2364 | + |
| 2365 | + |
| 2366 | + |
| 2367 | + |
| 2368 | + |
| 2369 | + |
| 2370 | + |
| 2371 | + |
| 2372 | + |
| 2373 | + |
| 2374 | + |
| 2375 | + |
| 2376 | + |
| 2377 | + |
| 2378 | + |
| 2379 | + |
| 2380 | + |
| 2381 | + |
| 2382 | + |
| 2383 | + |
| 2384 | + |
| 2385 | + |
Collapse file
tests/unit/test_client_retry.py
Copy file name to clipboardExpand all lines: tests/unit/test_client_retry.py+6-1Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
23 | 23 | |
24 | 24 | |
25 | 25 | |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
26 | 31 | |
27 | 32 | |
28 | 33 | |
| ||
83 | 88 | |
84 | 89 | |
85 | 90 | |
86 | | - |
| 91 | + |
87 | 92 | |
88 | 93 | |
89 | 94 | |
|
Collapse file
tests/unit/test_dbapi_cursor.py
Copy file name to clipboardExpand all lines: tests/unit/test_dbapi_cursor.py+5-1Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
480 | 480 | |
481 | 481 | |
482 | 482 | |
483 | | - |
| 483 | + |
| 484 | + |
| 485 | + |
| 486 | + |
| 487 | + |
484 | 488 | |
485 | 489 | |
486 | 490 | |
|
0 commit comments