Commit 33af6f4
Drop inherited state in DqliteConnection.close() fork short-circuit
The fork-after-init short-circuit cleared _protocol and _db_id only.
The remaining state — _pending_drain (an asyncio.Task bound to the
parent's loop), _in_transaction, _tx_owner, _savepoint_stack,
_savepoint_implicit_begin, _has_untracked_savepoint, _bound_loop —
crossed the fork boundary intact. The Task in particular kept the
inherited writer transport alive via its coroutine frame, blocking
the kernel from reaping the FD and emitting the "Task was destroyed
but it is pending" warning on every forked-worker GC sweep — exactly
the warning the parent's _pending_drain-await machinery was built to
suppress.
Clear all eight items in the fork branch so GC in the child has no
references to parent-loop primitives or inherited FDs, and so the
child's view of the connection (in_transaction etc.) stays
self-consistent for any debugger / metric collector inspecting it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5a49e37 commit 33af6f4
2 files changed
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1097 | 1097 | | |
1098 | 1098 | | |
1099 | 1099 | | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
1100 | 1111 | | |
1101 | 1112 | | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1102 | 1120 | | |
1103 | 1121 | | |
1104 | 1122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
110 | 150 | | |
111 | 151 | | |
112 | 152 | | |
| |||
0 commit comments