Skip to content

Conversation

@vyavdoshenko
Copy link
Contributor

@vyavdoshenko vyavdoshenko commented May 10, 2025

Fixes: #5096

This PR fixes a crash when starting Dragonfly if the Memcached port is the same as the Redis port.

@vyavdoshenko vyavdoshenko self-assigned this May 10, 2025
acceptor->AddListener(mc_port, listener.get());
listeners.push_back(listener.release());

if (mc_port == static_cast<uint32_t>(port)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the original behavior of exiting the process is correct.
proceeding on startup when a serious error was discovered is not correct.
so if you want to avoid "crashing", you can just exit(1) nicely if acceptor->AddListener fails.
no need to compare ports as it's not important at the end.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see how we do it with "main_listener".
in fact - every AddListener call in this file should be handled like that: check if there is an error, log it and exit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@vyavdoshenko vyavdoshenko requested a review from romange May 11, 2025 09:13
@vyavdoshenko vyavdoshenko enabled auto-merge (squash) May 11, 2025 09:20
@vyavdoshenko vyavdoshenko merged commit 5f454db into main May 11, 2025
10 checks passed
@vyavdoshenko vyavdoshenko deleted the bobik/memcached_port_the_same_as_redis branch May 11, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dragonfly crashes if Memcahed port is the same as Redis port

3 participants