Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Initial, incomplete) OTP26 compatibility #7900

Merged
merged 21 commits into from
Apr 17, 2023
Merged

Conversation

mkuratczyk
Copy link
Contributor

NOTE: do not merge yet (PR created to run tests on OTP25)

WIP: changes needed for OTP26 compatibility. This doesn't address all the issues at this point

mkuratczyk and others added 16 commits April 13, 2023 14:37
OTP-26 changed the default version for binary_to_term from 1 to 2.
There's one place where we explicitly ask for version 1 anyway
(in the STOMP plugin) and seems like we need to keep it like this.
These algorithms, introduced in OTP-26, are not compatible
with what we do in this test.
Fix for OTP-26+. We don't care about the security of the TLS
connection in that test.
We don't care about the security of the TLS connection in that test.
While at it, refactor `rabbit_misc:plmerge/2` to use the same precedence
as maps:merge and lists:merge (the second argument supersedes the first
one)
This no longer works with OTP-26 and will not work moving
forward. So we do like ssl and simulate a real port command.
An inadvertent dependency on small map atom key ordering had been taken
inside the stream election code in the stream coordinator state machine.

With the key ordering changes in OTP 26 this resulted in divergent state
in different stream coordinator members which resulted in stream recovery
failing.
The test was also not testing what it claimed to test
(it was using verify_none so not sending the client
certificates). This commit fixed that as well.
OTP-26 sets verify_peer by default so the warning is no longer
relevant. The function can be removed when we support OTP-26+ only.
@mkuratczyk mkuratczyk changed the title Otp26 compatibility OTP26 compatibility Apr 14, 2023
@michaelklishin michaelklishin changed the title OTP26 compatibility (Initial, incomplete) OTP26 compatibility Apr 14, 2023
ansd
ansd previously requested changes Apr 17, 2023
deps/rabbit_common/src/rabbit_net.erl Show resolved Hide resolved
Similarly to #7663,
increase the message size and decrease the client buffer sizes.

This change is needed because we switched from erlang:port_command/2 to
gen_tcp:send/2. The former is a bit more asynchronous than the latter
because the latter waits for the inet_reply from the port.
In OTP 25, gen_tcp:send/2 has poor performance when the Erlang mailbox
is large because the selective receive is not optimised.

https://erlang.org/download/otp_src_26.0-rc3.readme

OTP-18520    Application(s): erts
               Related Id(s): GH-6455

               gen_tcp:send/*, gen_udp:send/* and gen_sctp:send/* have
               been optimized to use the infamous receive reference
               optimization, so now sending should not have bad
               performance when the calling process has a large
               message queue.
@michaelklishin michaelklishin dismissed ansd’s stale review April 17, 2023 17:25

David has addressed his own review

@michaelklishin michaelklishin added this to the 3.12.0 milestone Apr 17, 2023
@michaelklishin michaelklishin merged commit 0533288 into main Apr 17, 2023
@michaelklishin michaelklishin deleted the otp26-compatibility branch April 17, 2023 17:31
michaelklishin added a commit that referenced this pull request Apr 18, 2023
(Initial, incomplete) OTP26 compatibility (backport #7900)
ansd added a commit that referenced this pull request Apr 18, 2023
Revert the change introduced in #7900

RabbitMQ 3.12 will require OTP 25 (not yet OTP 26).

The use of macro `OTP_RELEASE` was wrong because RabbitMQ can be
compiled with OTP 25, but run with OTP 26. Macros are evaluated at
compile time.

An alternative runtime equivalent would have been
```
1> erlang:system_info(otp_release).
"26"
```
mergify bot pushed a commit that referenced this pull request Apr 18, 2023
Revert the change introduced in #7900

RabbitMQ 3.12 will require OTP 25 (not yet OTP 26).

The use of macro `OTP_RELEASE` was wrong because RabbitMQ can be
compiled with OTP 25, but run with OTP 26. Macros are evaluated at
compile time.

An alternative runtime equivalent would have been
```
1> erlang:system_info(otp_release).
"26"
```

(cherry picked from commit 81d21f5)
@mkuratczyk mkuratczyk mentioned this pull request Apr 20, 2023
8 tasks
@michaelklishin
Copy link
Member

@Mergifyio backport v3.11.x

@mergify
Copy link

mergify bot commented May 12, 2023

backport v3.11.x

✅ Backports have been created

@michaelklishin
Copy link
Member

Backporting this to v3.11.x is complicated, the code paths changed involve unrelated changes e.g. from #6440. It's not necessarily worth it for a series that will go out of community support in Dec 2023.

michaelklishin pushed a commit that referenced this pull request May 28, 2023
Revert the change introduced in #7900

RabbitMQ 3.12 will require OTP 25 (not yet OTP 26).

The use of macro `OTP_RELEASE` was wrong because RabbitMQ can be
compiled with OTP 25, but run with OTP 26. Macros are evaluated at
compile time.

An alternative runtime equivalent would have been
```
1> erlang:system_info(otp_release).
"26"
```

(cherry picked from commit 81d21f5)
@michaelklishin
Copy link
Member

I have backported all commits from this PR except for c8b4742. The delta in stream coordinator code is non-trivial.

However, with these improvements nodes can accept connections and generally work fine (all Bunny tests pass, for example).

So this is a sufficient improvement to ship, right now RabbitMQ 3.11.16 on Erlang 26 cannot accept client connections, which makes us look really bad to the Windows users who download the latest Erlang installer.

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.

5 participants