int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
void *recvbuf, const int *recvcounts, const int *displs,
MPI_Datatype recvtype, int root, MPI_Comm comm)
Not super familiar with this, but recvcounts and displs are both declared const in the call, so I suspect the children don’t actually send their sizes (cause where would that get written?).
I guess it seems strange that the asymmetry here makes room for a bug (worker sends more data than host is ready for)? But I think MPI is usually more manual than automatic.