Skip to content

#75: Implemented socket abstraction library - #77

Open
sgn4sangar wants to merge 27 commits into
mainfrom
feature/75_implement_socket_abstraction_library
Open

sgn4sangar wants to merge 27 commits into
mainfrom
feature/75_implement_socket_abstraction_library

Conversation

@sgn4sangar

Copy link
Copy Markdown
Collaborator

fixes #75

@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval September 30, 2026 07:16 — with GitHub Actions Waiting
Comment thread udf-runner-cpp/v2/include/exasol/udf/v2/socket/socket.hpp Outdated
@sgn4sangar
sgn4sangar force-pushed the feature/75_implement_socket_abstraction_library branch from 7d4b2d4 to f4ee0d7 Compare October 3, 2026 07:42
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 3, 2026 07:42 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 5, 2026 09:27 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 5, 2026 11:39 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 5, 2026 12:19 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 5, 2026 14:22 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 6, 2026 05:00 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 7, 2026 06:11 — with GitHub Actions Waiting
Comment thread udf-runner-cpp/v2/BUILD.bazel
Comment thread udf-runner-cpp/v2/socket/socket_fuzz_test.cc
Comment thread udf-runner-cpp/v2/socket/socket_test.cc Outdated
ASSERT_EQ(::close(second_pipe[1]), 0);
}

TEST(SocketTest, ListenerConnectsAcceptsAndRequiresExplicitCleanup)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe move all tests which use the unique_socket_path into a GTest fixture, which provides the temp path, and then automatically cleans up the temporary directory in TearDown().

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In db reference, there is a dedicated RAII cleanup class; the v2 fixture currently performs the cleanup directly in TearDown(), which, i guess matches the requested behavior. pls correct me if i am wrong

Comment thread udf-runner-cpp/v2/socket/socket_test.cc
Comment thread udf-runner-cpp/v2/socket/socket_test.cc Outdated
Comment thread udf-runner-cpp/v2/socket/unix_socket.cc Outdated
Comment thread udf-runner-cpp/v2/socket/unix_socket.cc Outdated
Comment thread udf-runner-cpp/v2/socket/unix_socket.cc Outdated
Comment thread udf-runner-cpp/v2/socket/unix_socket.cc Outdated
Comment thread udf-runner-cpp/v2/socket/socket_test.cc Outdated
Comment thread udf-runner-cpp/v2/socket/unix_socket.cc Outdated

UnixSocketListener::~UnixSocketListener()
{
close();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel like the design does not follow RAII principles, we should also add the "unlink" to the destructor,
this would also thin out the public API

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@tkilias should we go for it? i remember you saying the unix-sock-fd migrate between processes.

}
if (::listen(socket_fd.native_handle(), backlog) == -1)
{
throw std::system_error(errno, std::generic_category(), "listen on Unix socket");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

bind created the path, listen fails, how do you unlink the path then?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

UnixSocketListener::bind being a static function; if listen fails, i mean throws exception, is it not the caller's responsibility to unlink it.

Comment thread udf-runner-cpp/v2/socket/socket_fuzz_test.cc Outdated
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 9, 2026 11:18 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 9, 2026 16:22 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 12, 2026 05:17 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 12, 2026 05:20 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 12, 2026 07:49 — with GitHub Actions Waiting
@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 12, 2026 08:08 — with GitHub Actions Waiting
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
65.2% Coverage on New Code (required ≥ 80%)
D Security Rating on New Code (required ≥ A)
3 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@sgn4sangar
sgn4sangar requested a deployment to v2-fuzzing-pr-approval October 13, 2026 09:30 — with GitHub Actions Waiting
return std::exchange(this->file_descriptor, -1);
}

OwnedFileDescriptor::OwnedFileDescriptor(const int owned_fd) noexcept : file_descriptor(owned_fd)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

OwnedFileDescriptor impl should go into its own cc file


using exasol::udf::v2::socket::OwnedFileDescriptor;

TEST(SocketTest, OwnedDescriptorClosesExactlyOnceAfterMoveAndRelease)

@tkilias tkilias Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

rename file to the class that is actually tested here OwnedFileDescriptor

This branch is waiting to be deployed

1 waiting deployment
v2-fuzzing-pr-approval — 74bc72dd Waiting Oct 13, 2026 by sgn4sangar via pr_approval #164
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.

Implement Socket Abstraction library

4 participants