AcademySoftwareFoundation / AcademySoftwareFoundation/OpenTimelineIO
cycles in SerializableObjects cause crashes
- Dominant language
- C++
- Stars
- 2k
- Forks
- 351
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 1
Description
## Bug Report
If C++ OTIO is compiled with INSTANCING_SUPPORT then cyclic references are handled fine. Without it, however, the following code causes a crash:
```
import opentimelineio as otio
so = otio.core.SerializableObjectWithMetadata()
so.metadata["child"] = so
so.clone()
```
However, we need to distinguish the above with the following, which needs to remain legal:
```
import opentimelineio as otio
so = otio.core.SerializableObjectWithMetadata()
soA = otio.core.SerializableObjectWithMetadata()
so.metadata["child1"] = soA
so.metadata["child2"] = soA
so.clone()
```
That is, during serialization, the object `soA` will be encountered more than once, yet this should not yield an error (because it doesn't now). In other words, the only behavior change we're trying to make is throwing an exception (or returning an error in C++) in cases where we would certainly crash to infinite recursion.
Contributor guide
Research direction
Reproduce the two Python snippets against C++ built with and without INSTANCING_SUPPORT, then trace SerializableObjectWithMetadata.clone() through the serialization path. Done means the cyclic self-reference raises an exception or returns a C++ error without crashing, while the shared soA reference remains legal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100