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

Possibility of port conflicts #29

Open
fluffynuts opened this issue Jun 12, 2020 · 2 comments
Open

Possibility of port conflicts #29

fluffynuts opened this issue Jun 12, 2020 · 2 comments

Comments

@fluffynuts
Copy link
Owner

I've seen a mysql tempdb attempt to start up and fail with this in the error log:

2020-06-12T08:35:11.547292Z 0 [ERROR] Can't start server: Bind on TCP/IP port: No such file or directory
2020-06-12T08:35:11.547717Z 0 [ERROR] Do you already have another mysqld server running on port: 49932 ?

Perhaps TempDbMySql could look for mysql-err.log and try to grok this issue; if found, re-randomize the port and try again.

@Exouxas
Copy link

Exouxas commented Oct 12, 2022

Saw this issue while browsing for stuff to do. Doesn't this commit 7979972 fix this issue? Or does this problem still occur even with the port finder?

@fluffynuts
Copy link
Owner Author

fluffynuts commented Oct 12, 2022

I don't see this often, but it's still possible as a race condition, especially if you're setting the TEMPDB_PORT_HINT environment variable (which is really useful if you'd like to connect to the tempdb with other tools whilst debugging). Basically, we select a random port (or the hinted one), test if it's in use (and if it is, re-roll, or, if using the hint, increment), then try to start up mysql - which is not instantaneous. So if you're using the port hint and run test assemblies in parallel, it's quite possible to trigger this; if you're running without the port hint, it's possible, but a lot less likely. Of course, it's also possible that something else grabs the port in the second or two it takes mysql to get up and listening.

At any rate, it would be neat if, upon mysql failing to start, the tempdb wrapper could interrogate the error log, and if it sees a port conflict, try again with a new port. I just haven't gotten around to it yet, and it's infrequent enough that I haven't had my hand forced.

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

No branches or pull requests

2 participants