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

Fix client trying to use “occupied file” for socket. #3200

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

avifenesh
Copy link
Member

@avifenesh avifenesh commented Feb 18, 2025

#2985
#3226

Most of the changes are versions bump and the new rust edition fixes.

Relevant changes:
glide_pathes

Socket listener file

Adapted tests

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Create merge commit if merging release branch into main, squash otherwise.

@avifenesh avifenesh requested a review from a team as a code owner February 18, 2025 14:32
@avifenesh avifenesh changed the title Update dependencies and refactor random string generation Fix client trying to use “occupied file” for socket. Feb 18, 2025
@avifenesh avifenesh force-pushed the clean_socket_file_on_connect branch 2 times, most recently from 3451846 to 4c00879 Compare February 18, 2025 14:41
@avifenesh avifenesh marked this pull request as draft February 18, 2025 14:49
@avifenesh avifenesh force-pushed the clean_socket_file_on_connect branch 4 times, most recently from d793a2d to cf77e7d Compare February 20, 2025 02:13
@avifenesh avifenesh marked this pull request as ready for review February 20, 2025 02:38
@avifenesh avifenesh force-pushed the clean_socket_file_on_connect branch 6 times, most recently from bbd633d to 4d5983f Compare February 22, 2025 23:59
@avifenesh avifenesh requested a review from eifrah-aws February 23, 2025 02:25
@avifenesh avifenesh self-assigned this Feb 24, 2025
@avifenesh avifenesh force-pushed the clean_socket_file_on_connect branch 2 times, most recently from 3557cbd to 2b77a59 Compare March 1, 2025 11:29
Signed-off-by: avifenesh <[email protected]>
avifenesh added 2 commits March 1, 2025 12:02
Signed-off-by: avifenesh <[email protected]>
@avifenesh avifenesh force-pushed the clean_socket_file_on_connect branch from 2b77a59 to 6e38e4c Compare March 1, 2025 12:16
@avifenesh avifenesh requested a review from Yury-Fridlyand March 1, 2025 12:16
@avifenesh avifenesh force-pushed the clean_socket_file_on_connect branch from 6e38e4c to f9a09b0 Compare March 1, 2025 12:25
@avifenesh avifenesh force-pushed the clean_socket_file_on_connect branch from 0131ecf to 164a408 Compare March 1, 2025 12:46
@@ -73,10 +73,10 @@ native-tls = { version = "0.2", optional = true }
tokio-native-tls = { version = "0.3", optional = true }

# Only needed for rustls
rustls = { version = "0.22", optional = true }
rustls = { version = "0.23.23", optional = true }
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason we are locked into a specific minor version?

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually tried to do the opposite everywhere, mistake

@@ -160,13 +160,13 @@ disable-client-setinfo = []
tls = ["tls-native-tls"] # use "tls-native-tls" instead

[dev-dependencies]
rand = "0.8"
rand = "0.9"
Copy link
Contributor

Choose a reason for hiding this comment

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

imo, we should just use major version, e.g:

rand = "0"

Copy link
Member Author

Choose a reason for hiding this comment

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

When its not stable yet, minor can be breaking as well, that's why under one i left the minor

root_store.add(cert)?;
let native_certs = load_native_certs();
#[cfg(all(
feature = "tls-rustls",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we support both versions? if so, why?

@@ -1,2 +1,2 @@
use_try_shorthand = true
edition = "2018"
edition = "2024"
Copy link
Contributor

Choose a reason for hiding this comment

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

will this break on older versions of Ubuntu, for example 22.04 LTS? (I am not sure which version of Rust they provide, but this might be a concern)

Copy link
Contributor

Choose a reason for hiding this comment

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

we can also use 2021 if 2018 does not work with our current code base

Copy link
Member Author

Choose a reason for hiding this comment

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

Break for usage or break for development?

}

/// For ergonomics: Converts a string into a PathBuf.
fn string_to_pathbuf(string: &str) -> PathBuf {
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this shorter than writing PathBuf::from ?

pub glide_file: PathBuf,
}
/// GlidePaths struct implementation.
impl GlidePaths {
Copy link
Contributor

Choose a reason for hiding this comment

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

When I suggested using a GlidePaths struct, I was talking in general. However, your code always refers to the socket file. The struct should be for "general purpose" for example, once stabilized, we should use it with other file related components (for example, a global location where we want to place our logs)

Copy link
Member Author

Choose a reason for hiding this comment

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

Your comment was actually leading to the other direction 😅 i tried to still keep it a bit generic.

Let's put it this way -

  1. Want generic file struct
  2. I want it to be handy for, for example, doing socket file tasks. Meaning i do want the struct to have some special sockets functionality in addition.
  3. I don't want to create a whole component which is not needed yet. More like laying foundation, and when needed can be enlarged.

}

/// Create a new GlidePaths struct from string paths.
pub fn from_file_path(glide_file: &str) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed?

}

/// Create a new GlidePaths struct from string file name.
pub fn from_file_name(file_name: &str) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is how tests were built. The old implementation also had name options for tests.
I can remove it, but will need to refactor tests


/// Returns the path to the temporary directory where the socket file is stored.
fn glide_sock_dir_path() -> PathBuf {
let path = std::env::temp_dir()
Copy link
Contributor

Choose a reason for hiding this comment

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

GlidePaths should have common API, like:

impl GlidePaths {
	pub fn initialise() -> Result<(), io::Error> {
		// Create the directory structures once
	}

	pub fn temp_dir() -> Option<&PathBuf> {
	}

	pub fn logs_dir() -> Option<&PathBuf> {
	}

	pub fn socket_file() -> Option<&PathBuf> {
		/// Append the socket file name to the `Self::tmep_dir()`
	}
}

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.

[Task] Get rid of ring dependency in core Node/Docker: failed to bind listening socket
3 participants