Skip to content

Conversation

@michaelklishin
Copy link
Collaborator

@michaelklishin michaelklishin commented Jul 22, 2025

This is #14151 by @tomyouyou re-submitted by me to provide some context and make more suites run.

The value returned by the function in question is eventually returned by handle_call/3, which
supports two types of responses: explicit via gen_server:reply/2 and "automatic" via a return value, where the From value is implicitly used by the gen .

This PR addresses a case where a handle_call/3 returns a {stop, Reason, Reply, NewState}, in which case the reply is sent by an OTP loop process before gen_server terminates. The reply will implicitly (for a handle_call/3 implementation reader) use the caller/From value, which in some cases can be none.

In the init_it2 function, when returning stop with none 'From'. This will result in the following exceptions:

2025-06-28 16:01:15.636 [error] <0.1306.0>   crasher:, initial call: rabbit_amqqueue_process:init/1, pid: <0.1306.0>, registered_name: [], exception exit: {bad_return_value, {stop,normal, {existing, {amqqueue, {resource,<<"/">>,queue,<<"q13">>}, false,false,none, [{<<"x-queue-type">>,longstr, <<"classic">>}], <14981.1295.0>,[],[],[],undefined, undefined,[],[],live,0,[],<<"/">>, #{user => <<"rabbit_inside_user">>, system_creation => 1751098305370332559, recover_on_declare => true, creator =>, {1751099091,"10.225.80.5",50046, "none"}, last_system_creation =>, 1751096873022515385}, rabbit_classic_queue,#{}}}, {q,{amqqueue, {resource,<<"/">>,queue,<<"q13">>}, false,false,none, [{<<"x-queue-type">>,longstr, <<"classic">>}], <0.1306.0>,[],[],[],undefined,undefined,[], [],crashed,0,[],<<"/">>, #{user => <<"rabbit_inside_user">>, system_creation => 1751096873022515385, recover_on_declare => false, creator =>, {1751097374,"10.225.80.5",56254, "none"}, recover_vsn => 0, zretarts => [-576459962]}, rabbit_classic_queue,#{}}, none,false,undefined,undefined, {state, {queue,[],[],0}, {active,-576459961468389,1.0}, []}, undefined,undefined,undefined,undefined, {state,none,30000,undefined}, #{},undefined,undefined,undefined, {state,#{},delegate}, undefined,undefined,undefined,undefined, 'drop-head',0,0,running,false,0,undefined, <<"/">>,undefined,0,false,0,undefined,0,0,0,[], undefined,0,0,0,0,true}}}, in function  gen_server2:terminate/3 (gen_server2.erl, line 1172), ancestors: [<0.1089.0>,<0.511.0>,<0.471.0>,<0.470.0>, rabbit_vhost_sup_sup,rabbit_sup,<0.250.0>], message_queue_len: 0, messages: [], links: [<0.1089.0>], dictionary: [{virtual_host,<<"/">>}, {rand_seed, {#{max => 288230376151711743,type => exsplus, next => #Fun<rand.5.65977474>, jump => #Fun<rand.3.65977474>}, [134188285183854767|82006587006243019]}}, {debug_openv_dt_cfg,{1751097655,[1]}}, {process_name, {rabbit_amqqueue_process, {resource,<<"/">>,queue,<<"q13">>}}}], trap_exit: true, status: running, heap_size: 28690, stack_size: 28, reductions: 46062, neighbours:,

(cherry picked from commit e6ec4df)
@michaelklishin michaelklishin added this to the 4.2.0 milestone Jul 22, 2025
@michaelklishin michaelklishin merged commit 0183885 into main Jul 22, 2025
560 of 562 checks passed
@michaelklishin michaelklishin deleted the rabbitmq-server-14151 branch July 22, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants