Commit 920c2b9
committed
Detach socket on create_connection/create_unix_connection cancellation
When create_connection(sock=sock) or create_unix_connection(sock=sock) is
cancelled or raises, tr._close() closes the fd via libuv but the Python
socket object still believes it owns that fd number. Its __del__ later
closes whatever fd the OS recycled into that slot, corrupting unrelated
transports.
Call sock.detach() on the error path so the Python socket sets its
internal fd to -1, matching the semantics of standard asyncio where the
transport always takes full ownership of the socket.
Fixes #7381 parent a308f75 commit 920c2b9
2 files changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1181 | 1181 | | |
1182 | 1182 | | |
1183 | 1183 | | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
1184 | 1210 | | |
1185 | 1211 | | |
1186 | 1212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2065 | 2065 | | |
2066 | 2066 | | |
2067 | 2067 | | |
| 2068 | + | |
2068 | 2069 | | |
2069 | 2070 | | |
2070 | 2071 | | |
| |||
2307 | 2308 | | |
2308 | 2309 | | |
2309 | 2310 | | |
| 2311 | + | |
2310 | 2312 | | |
2311 | 2313 | | |
2312 | 2314 | | |
| |||
0 commit comments