AcademySoftwareFoundation / AcademySoftwareFoundation/OpenTimelineIO

cycles in SerializableObjects cause crashes

Open
#847 0 comments 0 reactions 0 assignees View on GitHub
bug
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.