Skip to content

Commit

Permalink
Fix MQTT on Mac OS OTP 26
Browse files Browse the repository at this point in the history
On Mac OS M1 and M2 with OTP 26, prior to this commit,
the following test failed:
```
make -C deps/rabbitmq_mqtt ct-reader t=tests:rabbit_mqtt_qos0_queue_overflow FULL=1
```
with:
```
reader_SUITE > tests > rabbit_mqtt_qos0_queue_overflow
    #1. {'EXIT',
            {function_clause,
                {emqtt_frame,parse_packet,
                    [{mqtt_packet_header,7,true,0,false},
                     <<120,120,120,120,120,120,120,120,120,120,120,120,120,120,
                       120,120,120,120,120,120,120,120,120,120,120,120,120,120,
                       120,120,120,120,48,159,31,0,31,114,97,98,98,105,116,95,
                       109,113,116,116,95,113,111,115,48,95,113,117,101,117,
                       101,95,111,118,101,114,102,108,111,119,120,120,120,120,
                       120,120,120,120,120,120,120,120,120,120,120,120,120,120,
                       120,120,120,120,120,120,120,120,120,120,120,120,120,120,
                       120,120,120,120,120,120,120,120,120,120,120,120,120,120,
                       120,120,120,120,120,120>>,
                     #{version => 4,max_size => 268435455,
                       strict_mode => false}],
                    [{file,"src/emqtt_frame.erl"},{line,182}]}}}
```

This is due to the OTP bug in erlang/otp#7566
Simply exporting the serialise_len/1 fixes this OTP bug.
  • Loading branch information
ansd committed Aug 16, 2023
1 parent f3c1287 commit a712db6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions deps/rabbitmq_mqtt/src/rabbit_mqtt_packet.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@

-export([init_state/0, reset_state/0,
parse/2, serialise/2]).

%% This function is nowhere called externally, but must be exported
%% to circumvent the bug in https://github.com/erlang/otp/issues/7566
%% If not exported, this function will return garbage binary data on OTP 26
%% on Mac OS M1 and M2.
-export([serialise_len/1]).

-export_type([state/0]).

-opaque state() :: unauthenticated | authenticated | fun().
Expand Down

0 comments on commit a712db6

Please sign in to comment.