Skip to content
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

limiter_node is not decremented correctly. #634

Closed
pranasge opened this issue Oct 27, 2021 · 1 comment
Closed

limiter_node is not decremented correctly. #634

pranasge opened this issue Oct 27, 2021 · 1 comment
Labels

Comments

@pranasge
Copy link

Simple test that hangs before reaching count:

{
	const int count = 50000;

	tbb::flow::graph graph{};
	std::atomic<int> processed;
	tbb::flow::input_node<int> input{ graph, [&](tbb::flow_control & fc) -> int {
		static int i = {}; 
		if (i++ > count) fc.stop();
		return i;
	} };
	tbb::flow::limiter_node<int, int> blockingNode{ graph, 1 };
	tbb::flow::multifunction_node<int, std::tuple<int>> processing{ graph, tbb::flow::serial, [&](const auto & value, typename decltype(processing)::output_ports_type & out) {
			if (value != count)
				std::get<0>(out).try_put(1);
			processed.store(value);
		} };

	tbb::flow::make_edge(input, blockingNode);
	tbb::flow::make_edge(blockingNode, processing);
	tbb::flow::make_edge(processing, blockingNode.decrementer());

	input.activate();

	while (true)
	{
		graph.wait_for_all();
		if (processed.load() == count)
			break;
	}
}

This test was run with: 2020_U3 and v2021.3.0 tbb versions.

@Iliamish Iliamish added the bug label Oct 28, 2021
@Iliamish
Copy link
Contributor

Thank you for the code, we were able to reproduce the described behavior on our side! Indeed, the implementation of the limiter_node is incorrect in this regard. We will work on the issue resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants