Skip to content

flow_graph: Assertion m_private_counter >= 0 failed #1595

Closed
@martinr0x

Description

Summary

When running TBB flow_graph I sporadically encounter Assertion m_private_counter >= 0 failed (located in the destroy function, line in file: 141) on destruction.
This is a similiar to Issue-639, only that I encounter it in succeeding TBB versions.

One thing that I observed is that the failure does not occur when setting tbb::flow::node_priority_t{0}.
This is not required in this minimal example, but needed in our implementation as we have other nodes with tbb::flow::node_priority_t{0}.

Version

Able to reproduce with TBB 2022.0.0

Environment

  • OS Ubuntu 22.04.4 LTS
  • Compiler: gcc 11.4.0 | clang 17

Steps To Reproduce

#include <iostream>
#include <cassert>
#include <tbb/flow_graph.h>

int main() {
    struct Message {
        int idx;
        [[maybe_unused]] char pad[1] = {0};
    };
    using NODE = tbb::flow::function_node<Message, tbb::flow::continue_msg>;
    int num_iterations = 10000;
    int node_activations = 0;

    tbb::flow::graph graph;
    NODE node{graph, tbb::flow::serial, [&]([[maybe_unused]] const auto& msg){ node_activations++; },
              tbb::flow::queueing{}, tbb::flow::node_priority_t{1}};

    for (int i{0}; i < num_iterations; i++) {
        node.try_put(Message{i});
    }

    graph.wait_for_all();
    assert (num_iterations == node_activations);
    return 0;
}

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions