Dear list,

in our current HPX driven project we encounter the 
following runtime error:

     data has already been set for this future: 
HPX(promise_already_satisfied)

The relevant code is as follows:

void Image::compose ( const Image& other);
hpx::future<Image> Container::render();

[...]

  std::vector<hpx::future<Image>> imageFutures;
  for (int i = 0; i < containers.size(); ++i)
        imageFutures.push_back(containers[i].render());
  
   Image image;
   hpx::lcos::local::spinlock mtx;

   hpx::lcos::wait_each([&](hpx::future<Image> img)
   {
       std::lock_guard<hpx::lcos::local::spinlock> 
lk(mtx);
       image.compose(img.get());
   }, imageFutures);

   return image;

The runtime error does not occur, when the line 
"image.compose(img.get());" is substituted with just 
"img.get();"
Note the argument of compose is a const reference.

So what exactly does the error message mean? At no point 
are we explicitly setting or modifying the data of a 
future.
The error only occurs when actually using the future, 
getting the future without further usage is safe.

The Container Class is a client side representation of a 
Container Component, so the render methods could run in 
parallel and possibly on remote machines.
The error only occurs if the vector imageFutures has more 
than one element, so only if there are multiple futures to 
wait on / multiple instances of render running.

What can cause this error in general? How to go about 
debugging it and what could be the problem with our 
implementation.

Kind Regards,

Kilian Werner

  
_______________________________________________
hpx-users mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to