AcademySoftwareFoundation / AcademySoftwareFoundation/OpenTimelineIO

Segmentation fault on pytest exit when creating a SerializableObjectWithMetadata

Open
#1,474 10 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

A user reported that there is a segmentation fault when running pytest + objects with metadata + the "fs" (fake filesystem) capture system.

Repro:
```python
import opentimelineio as otio

# Does not segfault if you comment out this "test"
def test_empty_fs(fs):
pass

def test_create_clip(capsys):
# can be child classes of SerializableObjectWithMetadata (Clip, Gap, etc),
# however other otio C++ classes appear to be ok (RationalTime, TimeRange,
# TimeTransform)
otio.core.SerializableObjectWithMetadata(
# also does not segfault if you comment this out
metadata={}
)
```

Output:
```
❯ pytest otio_pytest_seg_fault.py --disable-warnings
============================================== test session starts ===============================================
platform darwin -- Python 3.8.13, pytest-7.2.0, pluggy-1.0.0
rootdir: /private/var/tmp
plugins: pyfakefs-5.0.0
collected 2 items

otio_pytest_seg_fault.py .. [100%]

========================================== 2 passed, 1 warning in 0.09s ==========================================
zsh: segmentation fault pytest otio_pytest_seg_fault.py --disable-warnings
```

(The warning is related to our use of `imp` and appears to be a red herring)

Contributor guide

Open the contributing guide

Research direction

Start by running the provided pytest reproduction with the pyfakefs `fs` fixture, `capsys`, and an empty metadata dictionary. Compare the exit behavior with metadata omitted and with the other listed OpenTimelineIO C++ classes. Done means the reproduction completes without a segmentation fault on pytest exit while preserving the affected object behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
backend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.