8000 G-API: Fix streaming hangs for ConstSource & Improve troubleshooting logger messages by sivanov-work · Pull Request #21567 · opencv/opencv · GitHub
[go: up one dir, main page]

Skip to content

G-API: Fix streaming hangs for ConstSource & Improve troubleshooting logger messages #21567

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
merged 4 commits into from
Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions modules/gapi/src/executor/gstreamingexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,40 @@ class QueueReader
void rewindToStop(std::vector<Q*> &in_queues,
const std::size_t this_id)
{
for (auto &&qit : ade::util::indexed(in_queues))
{
auto id2 = ade::util::index(qit);
auto &q2 = ade::util::value(qit);
if (this_id == id2) continue;
size_t expected_stop_count = std::count_if(in_queues.begin(), in_queues.end(), [] (const Q* ptr) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you remind me how queue can be nullptr, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

return ptr != nullptr;
});

Cmd cmd;
while (q2 && !cv::util::holds_alternative<Stop>(cmd))
q2->pop(cmd);
if (expected_stop_count > 0) {
// NB: it requires to substract own queues id from total waiting queue count
// because it had got stop message before rewind was called
expected_stop_count--;
}
GAPI_LOG_DEBUG(nullptr, "id: " << this_id << ", queues count: " << in_queues.size() <<
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure that it's can somehow help user

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still a debug message, we have some already so I'd not care about this one

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, then @sivanov-work you can ignore these comments :)

", expected stop msg count: " << expected_stop_count);
size_t got_stop_count = 0;
while(got_stop_count < expected_stop_count) {
Copy link
Contributor

Choose a reason for hiding this comment

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

space after while

for (auto &&qit : ade::util::indexed(in_queues)) {
auto id2 = ade::util::index(qit);
auto &q2 = ade::util::value(qit);
if (this_id == id2) continue;

GAPI_LOG_DEBUG(nullptr, "drain next id: " << id2 <<
", stop count (" << got_stop_count << "/" <<
expected_stop_count << ")");
bool got_cmd = true;
while (q2 && got_cmd) {
Cmd cmd;
got_cmd = q2->try_pop(cmd);
if (got_cmd && cv::util::holds_alternative<Stop>(cmd)) {
got_stop_count ++;
GAPI_LOG_DEBUG(nullptr, "got stop from id: " << id2);
break;
}
}
}
}
GAPI_LOG_DEBUG(nullptr, "completed");
}

// This method handles a stop sign got from some input
Expand Down
0