There are two separate aspects in this, IMO. First, the random seed, and
then second, the pseudorandom algorithm.

The problem to me seems to be the seed. Even Mersenne Twisters will produce
duplicate UUIDs if they get seeded with the same initial seed data.
Therefore, what seems to be needed is to incorporate use
of std::random_device when seeding the UUID generator. Afaik it is a good
idea to also use Mersenne Twister instead of std::rand while making these
changes, but that is just an extra improvement to me.

If I understand correctly, in your application you are now using the
two-parameter version of container::container(messaging_handler& h, const
std::string& id) and you are providing your own id, generated using
std::mt19937_64. Is that correct?

On Wed, Jun 9, 2021 at 8:10 PM Robbie Gemmell <robbie.gemm...@gmail.com>
wrote:

> I have no idea what approach might be taken if any, but this certainly
> seems worth a JIRAt o me to track the general issue at least.
>
> On Wed, 9 Jun 2021 at 14:32, rherbert <nab...@ryan.xar.us> wrote:
> >
> > We spent a while tracking down a problem when we start up many services
> in
> > Docker containers simultaneously - when a client sent a request, we would
> > get responses from multiple services, even though each service should
> have
> > been bound to its own exchange.
> >
> > We tracked the problem down to here:
> >
> https://github.com/apache/qpid-proton/blob/8ddf5399013b02f1fd13bda3fee7886bd48a98be/cpp/src/uuid.cpp#L45
> >
> > When you're starting services in Docker containers, they all get the same
> > PID - so if you're starting a bunch of Docker containers simultaneously,
> the
> > odds are good that the seed will be the same across several of the
> services.
> > We were even seeing this problem across multiple hosts when the
> deployment
> > would push out a new build.
> >
> > We've worked around the issue by adding service identifiers and our own
> > unique identifier using std::mt19937_64.  I imagine our multi-container
> > situation is the only use case where this error would be common, but
> with a
> > lot of users, I would think that there would be intermittent issues.
> >
> > Is this something I should open a ticket for?  I don't have a patch for
> > proton - I don't know if using std::mt19937_64 is acceptable for the
> proton
> > code base.
> >
> >
> >
> > --
> > Sent from:
> http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
> > For additional commands, e-mail: users-h...@qpid.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
> For additional commands, e-mail: users-h...@qpid.apache.org
>
>

-- 
Mit freundlichen Grüßen / Kind regards
Jiri Daněk

Reply via email to