Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Fix permission issue when using skip-name-resolve, running a local MySQL database server and connecting via TCP - #6611

Merged
NateBrady23 merged 1 commit into
TechEmpower:masterfrom
lauxjpn:fix/mysql_ci
Jun 1, 2021
Merged

NateBrady23 merged 1 commit into
TechEmpower:masterfrom
lauxjpn:fix/mysql_ci

Conversation

@lauxjpn

@lauxjpn lauxjpn commented May 29, 2021 •

Copy link
Copy Markdown
Contributor

Currently, the MySQL benchmarks can randomly fail when run in CI/GitHub Actions. This happens in CI, but not on Citrine.

The issue seems to be, that the CI runs the database server on the same machine/system as the benchmarks (client) themselves. This means, that the client host is the local machine, usually resolved as localhost. But because we do not resolve client hostnames, because we use the skip-name-resolve option in the my.cnf to avoid the performance overhead name resolution brings, the local IP address 127.0.0.1 might not get resolved to localhost at all.

This only happens when using a local TCP connection, because MySQL seems to translate a Unix socket connection to localhost implicitly.

The result would be an exception, that the (TCP) connection could not be established to the database server, even though it is up and locally running. For example, this happened randomly on the #6566 (comment) PR.

Typically for MySQL, you would setup users for localhost and % (any host). For our CI usage here however, we need to explicitly add 127.0.0.1 as a hostname as well, so that non-resolved local TCP connections get mapped to a valid user account.

(Also modernizes the mysqld setup code a bit and gracefully shuts it down during the docker image setup. While I am not entirely sure, whether the latter is strictly necessary or not, it is what the official MySQL docker files do.)

… running a local MySQL database server and connecting via TCP.
@lauxjpn

lauxjpn commented May 29, 2021 •

Copy link
Copy Markdown
Contributor Author

Verified this against the ASP.NET Core MySQL tests. Looks good.

Verification Summary
--------------------------------------------------------------------------------
| aspcore-mvc-ado-my
|       query         : PASS
|       db            : PASS
|       update        : PASS
|       fortune       : PASS
| aspcore-mvc-dap-my
|       query         : PASS
|       db            : PASS
|       update        : PASS
|       fortune       : PASS
| aspcore-mw-ado-my
|       query         : PASS
|       db            : PASS
|       update        : PASS
|       fortune       : PASS
| aspcore-mw-dap-my
|       query         : PASS
|       db            : PASS
|       update        : PASS
|       fortune       : PASS
================================================================================

@NateBrady23

Copy link
Copy Markdown
Member

Fantastic! Thanks for doing this!

@NateBrady23
NateBrady23 merged commit 822f510 into TechEmpower:master Jun 1, 2021
@lauxjpn
lauxjpn deleted the fix/mysql_ci branch June 1, 2021 16:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants