AMQP 1.0 client: gracefully handle connection termination in more places (backport #17013)#17015
Merged
Merged
Conversation
…ces (#17013) * 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)
Author
|
Tick the box to add this pull request to the merge queue (same as
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should address some
function_clauseerrors observed when using AMQP 1.0 shovels.