Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8797501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:52:13+00:00 2026-06-13T23:52:13+00:00

I use a BroadcastBlock in TPL Dataflow which links to ActionBlocks . However, I

  • 0

I use a BroadcastBlock in TPL Dataflow which links to ActionBlocks. However, I cannot find a bug in my code. I post items to the BroadcastBlock via SendAsync and when I print the items in the ActionBlocks I find that some are missing and mysteriously others are duplicates. I keep track of the order of processed items and thus found that just at the occasion when an item is missing the previous or subsequent items is duplicated (fed to the same Actionblock via LinkTo). I have no idea what is going on. Here are couple of my code snippets that are relevant:

Here the instantiation of the BroadCastBlock:

buffer = new BroadcastBlock<Quote>(quote => quote);

Here’s how I link to action blocks:

//Filter for incoming quotes
Predicate<Quote> quoteBroadCastFilter = new Predicate<Quote>(newQuote =>
{
    if (symbol.symbolID == newQuote.symbol.symbolID)
    {
        return true;
    }
    else
    {
        return false;
    }
});

//Link Strategy up to BroadCastBlocks
buffer.LinkTo<Quote>(newStrategy.GetStrategyQuoteBuffer(), new DataflowLinkOptions { PropagateCompletion = true }, quoteBroadCastFilter);

This is how I submit items (quote) to the BroadCastBlock:

buffer.SendAsync(quote);

The problem is that when I print out tracking info right before sending via SendAsync everything looks perfectly fine. When I print the same information in the ActionBlock that BroadCastBlock links I observe infrequent errors. I noticed that the missing/duplicate items occur when items are fed to the BroadCastBlock very quickly (via EventHandler of an API)

Any idea what I am doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:52:15+00:00Added an answer on June 13, 2026 at 11:52 pm

    I answered my own question as I found the issue:

    Before the item is sent to BroadCastBlock, the item (of ref type) is read from a concurrent collection, updated, and then sent. So, it happened that sometimes the next item was already read from the collection and updated while the previous item still points to the same object which is now in the process of being updated. This in short caused the problems with items that were already in the BroadCastBlock. There was no problem post BroadCastBlock clone but before with items in the input queue.

    I had to perform a deep copy of the Quote object before sending it via Post or SendAsync to the broad cast block.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Use case: I find a piece of code that I do not understand at
Use the static modifier to declare a static member, which belongs to the type
Use Case I need to package up our kml which is in a String
use warnings; use Test::More; use File::Find::Rule; use Test::File::Find::Rule; my $rule = File::Find::Rule->file->name('*.pl')->not_grep(qr/^\s*use\s+strict;/m, sub {
Use case example: Client A comes to request sales information, enters their zip code
use this code, in the Preferences activity, to know when the reset preference has
Use case: we have some project meta-data files which we want tracked, but are
use case is simple: I want to run some boiler plate code before each
use grep command to find txt files containing telephone number. telephone number format could
Use: The user searches for a partial postcode such as 'RG20' which should then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.