-
Notifications
You must be signed in to change notification settings - Fork 27
Fixing left over fd on child processes #289
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
Merged
NicolasFussberger
merged 7 commits into
eclipse-score:main
from
etas-contrib:fix-leaked-fd
Jul 13, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a5fa6f0
Fixing left over fd on child processes
MaciejKaszynski 468bce4
Adding other application type tests
MaciejKaszynski 6950b11
Adding tests for other application types
MaciejKaszynski 7df2ebd
Addressing Review
MaciejKaszynski 0e36c94
Fixing leak with new FDs
MaciejKaszynski d9d910c
Addressing review comments
MaciejKaszynski 339977c
Merge branch 'main' into fix-leaked-fd
NicolasFussberger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
| load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files") | ||
| load("@rules_pkg//pkg:tar.bzl", "pkg_tar") | ||
| load("//:defs.bzl", "launch_manager_config") | ||
| load("//tests/utils/bazel:integration.bzl", "integration_test") | ||
|
|
||
| launch_manager_config( | ||
| name = "lm_process_fd_leak_config", | ||
| config = "//tests/integration/process_fd_leak:process_fd_leak.json", | ||
| flatbuffer_out_dir = "etc", | ||
| ) | ||
|
|
||
| cc_binary( | ||
| name = "native", | ||
| srcs = [ | ||
| "get_fds.hpp", | ||
| "native.cpp", | ||
| ], | ||
| deps = [ | ||
| "//tests/utils/test_helper", | ||
| "@googletest//:gtest_main", | ||
| "@score_baselibs//score/mw/log", | ||
| ], | ||
| ) | ||
|
|
||
| cc_binary( | ||
| name = "reporting", | ||
| srcs = [ | ||
| "get_fds.hpp", | ||
| "reporting.cpp", | ||
| ], | ||
| deps = [ | ||
| "//score/launch_manager:lifecycle_cc", | ||
| "//tests/utils/test_helper", | ||
| "@googletest//:gtest_main", | ||
| ], | ||
| ) | ||
|
|
||
| cc_binary( | ||
| name = "control_client", | ||
| srcs = [ | ||
| "control_client.cpp", | ||
| "get_fds.hpp", | ||
| ], | ||
| deps = [ | ||
| "//score/launch_manager:control_cc", | ||
| "//score/launch_manager:lifecycle_cc", | ||
| "//tests/utils/test_helper", | ||
| "@googletest//:gtest_main", | ||
| "@score_baselibs//score/mw/log", | ||
| ], | ||
| ) | ||
|
|
||
| pkg_files( | ||
| name = "main_files", | ||
| srcs = [ | ||
| ":control_client", | ||
| ":native", | ||
| ":reporting", | ||
| "//score/launch_manager", | ||
| ], | ||
| attributes = pkg_attributes(mode = "0777"), | ||
| prefix = "tests/process_fd_leak", | ||
| ) | ||
|
|
||
| pkg_files( | ||
| name = "configs", | ||
| srcs = [":lm_process_fd_leak_config"], | ||
| prefix = "tests/process_fd_leak", | ||
| ) | ||
|
|
||
| pkg_tar( | ||
| name = "process_fd_leak_binaries", | ||
| srcs = [ | ||
| ":configs", | ||
| ":main_files", | ||
| ], | ||
| ) | ||
|
|
||
| integration_test( | ||
| name = "process_fd_leak", | ||
| srcs = ["process_fd_leak.py"], | ||
| tags = ["integration"], | ||
| test_binaries = ":process_fd_leak_binaries", | ||
| deps = ["//tests/utils/testing_utils"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /******************************************************************************** | ||
| * Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information regarding copyright ownership. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Apache License Version 2.0 which is available at | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| ********************************************************************************/ | ||
| #include <gtest/gtest.h> | ||
|
|
||
| #include <sstream> | ||
|
|
||
| #include "get_fds.hpp" | ||
| #include "tests/utils/test_helper/test_helper.hpp" | ||
| #include <score/mw/lifecycle/control_client.h> | ||
| #include <score/mw/lifecycle/report_running.h> | ||
|
|
||
| int g_argc; | ||
| char** g_argv; | ||
|
|
||
| TEST(ControlClientFDs, FindOpenFDs) | ||
| { | ||
|
|
||
| TEST_STEP("Before Running") | ||
| { | ||
| auto open_fds = get_fds(); | ||
| EXPECT_TRUE(filter_fd(open_fds, std::regex("/dev/shm/ipc_shared_mem[0-9]+"))); | ||
| EXPECT_TRUE(filter_fd(open_fds, std::regex("/dev/shm/_nudge~._.~me_"))); | ||
| std::ostringstream oss; | ||
| oss << open_fds; | ||
| EXPECT_TRUE(open_fds.empty()) << "Found open files!\n" << oss.str(); | ||
| } | ||
|
|
||
| score::mw::lifecycle::report_running(); | ||
|
|
||
| TEST_STEP("After Running") | ||
| { | ||
| auto open_fds = get_fds(); | ||
| EXPECT_TRUE(filter_fd(open_fds, std::regex("/dev/shm/ipc_shared_mem[0-9]+"))); | ||
|
MaciejKaszynski marked this conversation as resolved.
|
||
| EXPECT_TRUE(filter_fd(open_fds, std::regex("/dev/shm/_nudge~._.~me_"))); | ||
| std::ostringstream oss; | ||
| oss << open_fds; | ||
| EXPECT_TRUE(open_fds.empty()) << "Found open files!\n" << oss.str(); | ||
| } | ||
|
|
||
| score::mw::lifecycle::ControlClient client{}; | ||
|
|
||
| TEST_STEP("After Control Client") | ||
| { | ||
| auto open_fds = get_fds(); | ||
| EXPECT_TRUE(filter_fd(open_fds, std::regex("/dev/shm/ipc_shared_mem[0-9]+"))); | ||
| EXPECT_TRUE(filter_fd(open_fds, std::regex("/dev/shm/_nudge~._.~me_"))); | ||
| std::ostringstream oss; | ||
| oss << open_fds; | ||
| EXPECT_TRUE(open_fds.empty()) << "Found open files!\n" << oss.str(); | ||
| } | ||
| } | ||
|
|
||
| int main(int argc, char** argv) | ||
| { | ||
| g_argc = argc; | ||
| g_argv = argv; | ||
|
|
||
| TestRunner runner{__FILE__, TerminationBehavior::kContinue, TerminationNotification::kTestEnd}; | ||
|
|
||
| return runner.RunTests(); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.