Commit d78ada1
* amqp10_client: handle DOWN in more states
When running AMQP 1.0 shovels, sometimes they would crash with errors
like this:
```
reason: {function_clause,
[{amqp10_client_connection,hdr_sent,
[info,
{'DOWN',#Ref<0.2037148225.2260205569.233493>,process,
<0.29675.0>,normal},
{state,0,<0.29672.0>,
#Ref<0.2037148225.2260205569.233493>,<0.29676.0>,
[{<0.29530.0>,
[alias|
#Ref<0.0.3779843.2037148225.2260271105.233488>]}],
<0.29675.0>,
{tcp,#Port<0.396>},
undefined,undefined,
#{notify => <0.29530.0>,port => 5672,
address => "green",
sasl =>
{encrypted,
<<"6APRufcR3aNjXGKFDynwAyf37GF3YqrJq06ecxGXPXNcdqSEXEKXoitUXhMTLBRhzdnWAQmdu9lw2aZ5TlxChT04sNM7XiCPZVhVFwKI124OLrxsEKjS0zOvYZc8wAlT02XqNHL4HGv9YHRGNX2aFpYCsLVTdEL4yRA8COvRomXsCDuCJ1XpWNvo/Y6fTjkW9PzfZiOwPWyfyvBx2nVCMw==">>},
hostname => <<"green">>,
properties =>
#{<<"ignore-maintenance">> => {boolean,true}},
notify_when_opened => <0.29530.0>,
notify_when_closed => <0.29530.0>,
transfer_limit_margin => 0,
max_frame_size => 1048576}}],
[{file,"amqp10_client_connection.erl"},{line,244}]},
{gen_statem,loop_state_callback,11,
[{file,"gen_statem.erl"},{line,3735}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,329}]}]}
```
* amqp10_client: handle unexpected EXIT reasons in close_sent
Connections linked by their owner (e.g. AMQP 1.0 shovels call
link/1 on the connection PID) could crash with a function_clause
error if that owner exited with a reason other than shutdown while
the connection was in the close_sent state:
```
reason: {function_clause,
[{amqp10_client_connection,close_sent,
[info,
{'EXIT',<0.11280.0>,killed},
{state,1,<0.11283.0>,
#Ref<0.1827165118.3650617346.181159>,<0.11287.0>,[],
<0.11285.0>,
{tcp,#Port<0.308>},
15000,
{once,#Ref<0.1827165118.3651141633.134174>},
#{notify => <0.11280.0>,port => 5672,
address => "green",
hostname => <<"green">>,
notify_when_opened => <0.11280.0>,
notify_when_closed => <0.11280.0>}}],
[{file,"amqp10_client_connection.erl"},{line,350}]},
{gen_statem,loop_state_callback,11,
[{file,"gen_statem.erl"},{line,3735}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,329}]}]}
```
close_sent/3 only matched EXIT signals with reason shutdown or
{shutdown, _}, which is what our own supervisor sends when it wants
us to terminate gracefully within its own timeout. Any other EXIT
reason, such as an owning process being killed, now stops the
connection instead, mirroring how we already give up waiting for a
close frame when the reader process goes down.
(cherry picked from commit f815505)
Co-authored-by: Michal Kuratczyk <michal.kuratczyk@broadcom.com>
1 parent 67fa17a commit d78ada1
1 file changed
Lines changed: 18 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
231 | 234 | | |
232 | 235 | | |
233 | 236 | | |
| |||
239 | 242 | | |
240 | 243 | | |
241 | 244 | | |
242 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
243 | 249 | | |
244 | 250 | | |
245 | 251 | | |
| |||
254 | 260 | | |
255 | 261 | | |
256 | 262 | | |
257 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
258 | 267 | | |
259 | 268 | | |
260 | 269 | | |
| |||
350 | 359 | | |
351 | 360 | | |
352 | 361 | | |
353 | | - | |
| 362 | + | |
354 | 363 | | |
355 | 364 | | |
356 | | - | |
| 365 | + | |
357 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
358 | 371 | | |
359 | 372 | | |
360 | 373 | | |
| |||
0 commit comments