Unexpected behavior when receiving multiple objects in GH

Hi all,

We have created a query system in GH that lets us query objects in multiple streams and returns a list of objects’ URLs. We then need to receive them in GH but we cannot use any of the Recieve components.

  • The Async Receiver just receives the first objects when provided a list of URLs as the input. Having a glance at the source code, I guess this behavior is by design.

  • The Sync Receiver though has unexpected behavior. if provided a List or a DataTree, the component loops over the input but downloads the first object every time.

In case of the Sync Receiver, this is presumably not the intended behavior, but one thing that is puzzling me a bit is if it was intended to behave like the Async Receiver and receive one object only, or if it was supposed to download a list of objects. The component is TaskCapable and the input has GH_ParamAccess.item which makes it loop over the input; but in the SolveInstance method, there is this line that reads the input only once.

    protected override void SolveInstance(IGH_DataAccess DA)
      if (RunCount == 1)
        if (InputType == "Invalid") return;

      if (InPreSolve)

Also, since the variables are mostly class variables, I am not sure about the thread safety of the code. Is it something about the SynchronizationContext that I am missing?

1 Like

Hey @Ardeshir_Talaei!

Hmm… the sync component was developed by @Stam, so maybe he can give more insight on this, but it sounds like its definitely a bug. As far as I’m aware, the Sync nodes should be able to receive multiple urls as input.

I’ll open an issue for this and have a peek, but I agree the logic you’re pointing to seems contradicting one another (input type vs ParseInput call)

1 Like

Hey @Ardeshir_Talaei!

Got a chance to check this out today. Turns out that, even though the component doesn’t explicitly say so, it wasn’t really designed to pull more than one stream url at a time. Not sure where I got the idea they received multiple stream urls… :man_facepalming:t3:

The resulting multiple objects is in fact a bug, as this should not be allowed in the first place… And a warning should be displayed to clearly specify what’s happening.

Ideally, it would be nice to be able to pull multiple objects at once, but that would require a bit of a re-write of the current implementation, which is not something we had planned.

Mainly, it would most likely loose the ability to re-receive automatically whenever someone pushes a new commit. So it’s not something I’m happy just removing. :slight_smile:

Meanwhile, I’d be happy to continue this discussion and try to find a way to keep everyone happy :wink:

1 Like