-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue when repeatedly expanding and compacting jsonld with nested/type-scoped contexts #119
Comments
The problem seems to only happen with more complex contexts, I can run it with the following document 10'000 times without the problem cropping up:
|
This als works even though I saw the problem pop up in this `_project` object in the full example:
This also works even though it has nested/type scoped contexts:
(expand to see the full thing, don't want to clutter the conversation) |
Thanks, @Panaetius, I'll take a look. It's really useful to have something repeatable. The update uses internal dicts and an LRU cache for retaining referenced contexts, and the result of processing them relative to an active context. Keys are all created via UUIDs or the actual body of the context, so it's hard to see where there could be a collision, but there may be some internal memory issues that are getting triggered. As the ContextResolver can be specified at runtime, we can probably come up with a version that doesn't actually cache easily enough, or parameterize the creation of the ContextResolver to not cache. This would be a big performance loss, but would likely be a short-term solution to the problem you're seeing. |
…the object id of the active context. Fixes #119.
…the object id of the active context. Fixes #119.
Thank you very much! 🚀 |
…the object id of the active context. Fixes #119.
…the object id of the active context. Fixes #119.
Trying out PyLD 2.0.1 (Also happens with PyLD 2.0.0) on Python 3.6-3.8 and everything works great, performance improves significantly, but tests in our test suite started failing randomly.
After a lot of trial and error, it seems like when expanding and compacting, at random, contexts aren't applied correctly.
For instance
ends up being
which breaks our processing down the line.
I made a minimal example that showcases the issue.
pyld_reproduce_error.zip
The example loads the attached jsonld file, expands it and compacts it again with the original context. This is repeated until the data after expansion&compaction does not match the output of the last iteration of the loop.
The problem crops up anywhere between iteration 1 and 32 (average 6.5) when I ran it 100 times, it seems completely random when it crops up (Which in our test suite caused tests to fail at random).
Any idea what could be causing this?
The text was updated successfully, but these errors were encountered: