deepdetect
deepdetect copied to clipboard
/chain ID conflict if the same chain name is used simultaneously
Opening an issue to track the discussion.
If I use the same name for a chain while calling it repeatedly (sometimes from multiple threads, so simultaneously), I sometimes get a 500 error that the logger with that name already exists. I assume this is because the logger is created with a name based on the name passed in (e.g. /chain/specificname
so specificname
would be the logger name).
One way to avoid the issue is to simply append a unique ID to each call e.g. /chain/specificname-1234
Per discussion with @beniz:
the /chain call should use a different resource (i.e. the /specificname) as per REST spec. So in fact it'd be normal to get a 409 if the previous /chain call on the same REST resource has not terminated yet. Now, the logger error is annoying because it is actually spdlogger complaining at chain creation (every chain comes with its own logger, as per spdlogger design and ousr on top of this actually). This is to say that truely, the server should return a 409 conflict, but returns a 500 because the logger creation fails (since the previous logger has not yet been released), and it's considered an internal error. I do agree this is wrong. Also, the question about /chain ID has surfaced several times, which means the current usage / design needs to be perfected. You are correct that one way to fix both issue (the conflict on resources and the logger issue) would be to internally add a random id to every chain call. Note that one way to fix the issue immediately on your side is to do it on the client side.
For now, I've done exactly that - on my client side I've added a unique random id to each chain call to ensure a different resource name.