Open max-thoma opened 1 year ago
Finally got some time to look into this. Bug reproduced, it's a memory corruption. Those are particularly difficult to fix, but, I'm on it now, so, there's hope ... :)
Thank you very much for reporting!!!
Just wanted to propose a "workaround" for this crash you've found. In general, you should avoid to use "application/ld+json" for incoming requests. It puts an important extra load on the broker as it must parse the @context, create the hash tables, etc to be able to use the @context for expansion/compaction of the JSON-LD terms. Instead, host the @context somewhere (Orion-LD implements this service) and send the @context in the Link header instead. That's how you should always pass contexts, and I'm almost sure your crash will go away.
I'm not saying I'm not gonna fix the crash, of course not, I'm on it. But, sending lots and lots of copies of the same contexts to the broker "inline" (application/ld+json) is a very bad idea. All contexts are cached in RAM, and in the end, the broker will run out of RAM and crash for that reason instead (once I fix the bug).
Thank you for this insight! For my specific application, it will unfortunately not be possible to completely eliminate application/ld+json
incoming requests, because I need the functionality of the Context Broker to parse different @context
s. However, as a workaround, this is a great suggestion.
I have run into problems when two or more requests reach the
ngsi-ld/v1/entityOperations/upsert
endpoint at the same time. Orion-LD crashes without any error messages.This is my docker compose setup:
Orion-LD Versions:
This Python script reproduces the bug:
What I could gather so far is the following:
?options=update
is usedIf any other information is needed, I am happy to provide more details!