Commit afe169a
authored
Fix the issues with scheduling procedures (#3816)
# Description of Changes
This reapplies the patch from #3704, and fixes the issues that were
causing it to deadlock.
The reason it was deadlocking was that it allowed for the following
sequence of events:
* `SchedulerActor::handle_queued()` begins mutable tx
* `ModuleHost::disconnect_client()` submits call to `call_reducer(tx:
None)`
* scheduler submits call to `call_reducer(tx: Some)`
* `WasmModuleInstance::disconnect_client` now has to try to take tx
lock, but the scheduler's call_reducer already holds it and is behind it
in the queue
So, I moved most of the logic from `handle_queued` back to being
executed in the module worker thread, but kept the code in
`scheduler.rs` so that it can all be reasoned about locally.
Fixes #3645. Should I uncomment the implementation of
`ExportFunctionForScheduledTable for F: Procedure` now?
# Expected complexity level and risk
2 - there's a chance that this patch hasn't fully fixed the deadlock
issue from #3704, but I'm quite confident.
# Testing
- [x] Manually verified that deadlock no longer occurs - previously,
`while true; do python -m smoketests schedule_reducer -k
test_scheduled_table_subscription; done` would freeze up in only 2 or 3
iterations, but now it can run for 10 minutes without issues.1 parent e0dc9fb commit afe169a
219 files changed
Lines changed: 1653 additions & 384 deletions
File tree
- crates
- bindings
- src
- tests/ui
- codegen
- src
- tests/snapshots
- core/src/host
- v8
- wasm_common
- schema/src
- def/validate
- modules
- sdk-test-procedure-ts/src
- sdk-test-procedure/src
- sdks
- csharp/examples~/regression-tests
- procedure-client/module_bindings
- Procedures
- Reducers
- Tables
- Types
- republishing/client/module_bindings
- rust/tests
- connect_disconnect_client/src/module_bindings
- procedure-client/src
- module_bindings
- test-client/src/module_bindings
- view-client/src/module_bindings
- smoketests/tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
731 | 731 | | |
732 | 732 | | |
733 | 733 | | |
734 | | - | |
735 | | - | |
| 734 | + | |
736 | 735 | | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
745 | 744 | | |
746 | 745 | | |
747 | 746 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | | - | |
448 | | - | |
449 | | - | |
| 447 | + | |
450 | 448 | | |
451 | 449 | | |
452 | 450 | | |
| |||
467 | 465 | | |
468 | 466 | | |
469 | 467 | | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
480 | 477 | | |
481 | 478 | | |
482 | 479 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
| 426 | + | |
426 | 427 | | |
427 | 428 | | |
428 | 429 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
| 185 | + | |
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
| |||
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
| 299 | + | |
297 | 300 | | |
298 | 301 | | |
299 | 302 | | |
| |||
398 | 401 | | |
399 | 402 | | |
400 | 403 | | |
| 404 | + | |
401 | 405 | | |
402 | 406 | | |
403 | 407 | | |
| |||
527 | 531 | | |
528 | 532 | | |
529 | 533 | | |
| 534 | + | |
530 | 535 | | |
531 | 536 | | |
532 | 537 | | |
| |||
636 | 641 | | |
637 | 642 | | |
638 | 643 | | |
| 644 | + | |
639 | 645 | | |
640 | 646 | | |
641 | 647 | | |
| |||
745 | 751 | | |
746 | 752 | | |
747 | 753 | | |
| 754 | + | |
748 | 755 | | |
749 | 756 | | |
750 | 757 | | |
| |||
1066 | 1073 | | |
1067 | 1074 | | |
1068 | 1075 | | |
| 1076 | + | |
1069 | 1077 | | |
1070 | 1078 | | |
1071 | 1079 | | |
| |||
1170 | 1178 | | |
1171 | 1179 | | |
1172 | 1180 | | |
| 1181 | + | |
1173 | 1182 | | |
1174 | 1183 | | |
1175 | 1184 | | |
| |||
3577 | 3586 | | |
3578 | 3587 | | |
3579 | 3588 | | |
| 3589 | + | |
3580 | 3590 | | |
3581 | 3591 | | |
3582 | 3592 | | |
| |||
3887 | 3897 | | |
3888 | 3898 | | |
3889 | 3899 | | |
| 3900 | + | |
3890 | 3901 | | |
3891 | 3902 | | |
3892 | 3903 | | |
| |||
4050 | 4061 | | |
4051 | 4062 | | |
4052 | 4063 | | |
| 4064 | + | |
4053 | 4065 | | |
4054 | 4066 | | |
4055 | 4067 | | |
| |||
4460 | 4472 | | |
4461 | 4473 | | |
4462 | 4474 | | |
| 4475 | + | |
4463 | 4476 | | |
4464 | 4477 | | |
4465 | 4478 | | |
| |||
5013 | 5026 | | |
5014 | 5027 | | |
5015 | 5028 | | |
| 5029 | + | |
5016 | 5030 | | |
5017 | 5031 | | |
5018 | 5032 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
44 | 53 | | |
45 | 54 | | |
46 | 55 | | |
| |||
0 commit comments