Skip to content

MDEV-39473: main.mdev375, main.connect fail on macOS#5008

Open
DaveGosselin-MariaDB wants to merge 1 commit into10.11from
10.11-MDEV-39473-macos-tests
Open

MDEV-39473: main.mdev375, main.connect fail on macOS#5008
DaveGosselin-MariaDB wants to merge 1 commit into10.11from
10.11-MDEV-39473-macos-tests

Conversation

@DaveGosselin-MariaDB
Copy link
Copy Markdown
Member

When the server rejects a connection because connection_count exceeds the maximum allowed, the server will send ER_CON_COUNT_ERROR and immediately close the socket. On macOS, the client's recv() of that error packet sometimes fails with errno EINVAL before the packet is actually delivered, surfacing as CR_SERVER_LOST instead of ER_CON_COUNT_ERROR. Update the tests to account for this possibility.

When the server rejects a connection because connection_count exceeds
the maximum allowed, the server will send ER_CON_COUNT_ERROR and
immediately close the socket.  On macOS, the client's recv() of that
error packet sometimes fails with errno EINVAL before the packet is
actually delivered, surfacing as CR_SERVER_LOST instead of
ER_CON_COUNT_ERROR.  Update the tests to account for this possibility.
@svoj
Copy link
Copy Markdown
Contributor

svoj commented Apr 28, 2026

On macOS, the client's recv() of that error packet sometimes fails with errno EINVAL before the packet is actually delivered, surfacing as CR_SERVER_LOST instead of ER_CON_COUNT_ERROR.

@DaveGosselin-MariaDB and that's a bug, isn't it?

@svoj
Copy link
Copy Markdown
Contributor

svoj commented Apr 28, 2026

@svoj it seemed like a network stack related issue, especially where both the server and client are running on the same machine. Maybe there's a fast path that the operating system uses in this case? I don't see how we could change anything in our code to mitigate that.

@DaveGosselin-MariaDB missing vio_shutdown(SHUT_RDWR) call? There're not that many cases when the server closes connection. E.g. THD::awake_no_mutex() has this call.

@DaveGosselin-MariaDB
Copy link
Copy Markdown
Member Author

@svoj it seemed like a network stack related issue, especially where both the server and client are running on the same machine. Maybe there's a fast path that the operating system uses in this case? I don't see how we could change anything in our code to mitigate that.

@DaveGosselin-MariaDB missing vio_shutdown(SHUT_RDWR) call? There're not that many cases when the server closes connection. E.g. THD::awake_no_mutex() has this call.

Thanks @svoj I'll take another look into it.

@svoj
Copy link
Copy Markdown
Contributor

svoj commented Apr 28, 2026

@DaveGosselin-MariaDB Thank you for taking care of it! It might not be the vio_shutdown() in the end, but the idea still applies: check how KILL CONNECTION works and compare to ER_CON_COUNT_ERROR handling. In the end both can be broken. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants