-
Notifications
You must be signed in to change notification settings - Fork 179
[onert] Ensure proper pipeline cleanup on exceptions and shutdown #16379
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,7 @@ class BulkPipelineManagerTest : public ::testing::Test | |
| void TearDown() override {} | ||
|
|
||
| std::unique_ptr<BulkPipelineManager> manager; | ||
| const int nr_models = 1; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I missed to update this line in previous PR ;( -- const int nr_models = 2;
++ const int nr_models = 1; |
||
| }; | ||
|
|
||
| TEST_F(BulkPipelineManagerTest, test_initilize) | ||
|
|
@@ -71,9 +72,17 @@ TEST_F(BulkPipelineManagerTest, test_initilize) | |
|
|
||
| TEST_F(BulkPipelineManagerTest, test_shutdown) | ||
| { | ||
| int nr_fclose_calls = 0; | ||
| EXPECT_TRUE(manager->initialize()); | ||
| // This hook will checking the number of fclose() calls | ||
| MockSyscallsManager::getInstance().setFcloseHook([&nr_fclose_calls](FILE *) -> int { | ||
| nr_fclose_calls++; | ||
| return 0; | ||
| }); | ||
| manager->shutdown(); | ||
| EXPECT_FALSE(manager->isInitialized()); | ||
| // fclose() should be called as the same number of models | ||
| EXPECT_EQ(nr_fclose_calls, nr_models); | ||
|
Comment on lines
+75
to
+85
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is difficult to test the manipulated failure of |
||
| } | ||
|
|
||
| TEST_F(BulkPipelineManagerTest, test_execute) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From now on, any of exceptions including 'Asynchronous buffer filling' and 'Model execution' will call
shutdown()explicitly to release resources properly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if
BulkPipelineManager::shutdown()is always guaranteed not to throw exceptions. However, the current pipeline are already complex, and I'm don't know how to resolve this issue. So, I want to ignore this and move on to the next stage.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no case of throwing additional exception in
BulkPipelineManager::shutdown(). And even if an exception occurrs, it will abandon the previous one and proceed to the next one. 😊