Dear all,

I understand that the forum is for development of mpi and my question
is more of a user having a problem. Yet I have extensive experience in MPI
and C++ and hope my question will be interesting to you.

I am doing the operation 
mpi::request ereq = world.isend( .... );
boost::optional<mpi::status> stat = ereq.test();

if (stat)
        if (stat->error() != MPI_SUCCESS) {
          char error_string[10000];
          int length_of_error_string;
          MPI_Error_string(stat->error(), error_string, &length_of_error_string);
          fprintf(stderr, "err: %s\n", error_string);
What happens is that the error that occurs is
"MPI_T_ERR_CVAR_SET_NOT_NOW: The control variable cannot be set at this moment."
It is the first time that I see that error. 
As I understand it, the error means that the communication has not finished yet.
The "control variable" is of course unknown, could it be the error message itself?

The problem is two-fold:
1) First, I can see that the communication has finished since the counterpart
of the isend has indeed received the data and done plenty of work with it

2) The documentation for the "test()" operation says:
"Determine whether the communication associated with this request has completed successfully. If so, returns the status object describing the communication. Otherwise, returns an empty optional<> to indicate that the communication has not completed
Thus as I can see, If the stat is nontrivial then it means that the communication
has been done.

This occurred on a MacOS system with boost_mpi 1.74.0 installed via homebrew.
On a Linux system with boost_mpi 1.71.0 the error does not occur. However, there
may be problems as the use of
"mpirun -np 2 valgrind ./MyProg"
shows an error of the kind "Conditional jump or move depends on uninitialised value()"
at "if (stat->error() != MPI_SUCCESS)"

All advice welcomed. Let me know if I can provide more information.