Skip to content

Segmentation Fault When Adding SofaPython3 as Required Plugin #490

@antennae

Description

@antennae

Problem

Adding SofaPython3 as a RequiredPlugin causes a segmentation fault when running Python directly.

Description
I am writing a Python script for a scene I created, but I consistently encounter a segmentation fault at the finishing stage.

We identified that the issue occurs when including the SofaPython3 plugin as a RequiredPlugin.

  • runSofa seems to pre-load plugins, including SofaPython3, and adding it again in RequiredPlugin does not cause issues.

  • However, when running a standalone Python script that uses Sofa, explicitly adding SofaPython3 as a RequiredPlugin leads to a segmentation fault.

Steps to reproduce
Example script: test.py

import Sofa
import Sofa.Core

root = Sofa.Core.Node('rootNode')
root.addObject(
    'RequiredPlugin', name='SofaPython3 Sofa.Component.AnimationLoop'
)

Running the script: python test.py results in a segmentation fault.

Removing SofaPython3 from the RequiredPlugin list prevents the crash.

Expected behavior
Listing SofaPython3 as a RequiredPlugin should be valid and not cause a crash, as it is an intuitive way to declare dependencies.
At least, a warning should be given beforehand to indicate potential conflicts or redundant plugin loading.

Environment

  • OS: Ubuntu 24.04

  • Python Version: Python 3.12.3

  • SOFA Version: 24.12

  • SofaPython3 Version: 24.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions