SofaPython3 icon indicating copy to clipboard operation
SofaPython3 copied to clipboard

Segmentation Fault When Adding SofaPython3 as Required Plugin

Open antennae opened this issue 9 months ago • 0 comments

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

antennae avatar Mar 27 '25 12:03 antennae