Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mechanism Loading Issues: nrn_dll_loaded does not update and Segfaults #2741

Open
anilbey opened this issue Feb 15, 2024 · 0 comments
Open
Labels

Comments

@anilbey
Copy link
Contributor

anilbey commented Feb 15, 2024

Context

Overview of the issue

When using NEURON for API development, we encountered an issue where nrn_dll_loaded remains empty even after mechanisms are loaded automatically. This discrepancy leads to a situation where the load_mechanisms function is unable to accurately determine if mechanisms have been loaded, resulting in a segmentation fault when attempting to load mechanisms that are already present. Additionally, the load_mechanisms function does not account for canonical vs. non-canonical path forms, causing further issues when paths provided are relative or symbolic links.

Expected result/behavior

The expected behavior is for nrn_dll_loaded to be accurately updated upon the automatic loading of mechanisms, allowing the load_mechanisms function to correctly identify already loaded mechanisms and prevent attempts to reload them, thus avoiding segmentation faults. Furthermore, the load_mechanisms function should convert provided paths to their canonical form before checking against already loaded paths to ensure reliability and prevent errors due to path discrepancies.

NEURON setup

  • Version: 8.2.4 and 8.2.3 and possibly the older versions as well
  • Installation method: pip
  • OS + Version: OS-agnostic
  • Compiler + Version: Compiler-agnostic

Minimal working example - MWE

To reproduce the issue regarding nrn_dll_loaded being empty and segmentation fault on mechanism reload:

  1. nrn_dll_loaded is empty although the mechanisms are loaded:
from neuron import h, load_mechanisms, nrn_dll_loaded
print(nrn_dll_loaded)  # Expected to show loaded mechanisms, but shows []
>>> dir (neuron.h)  # these are the loaded mechanisms
['APCount', 'AlphaSynapse', 'Avogadro_constant', 'BBSaveState', 'BnlDev_StochKv', 'BnlDev_StochKv3', 'CVode', 'Ca', 'CaDynamics_DC0', 'CaDynamics_E2', 'Ca_HVA', 'Ca_HVA2', 'Ca_LVAst', 'ChkProb_StochKv', 'ChkProb_StochKv3', 'DEG', 'Deck', 'DetAMPANMDA', 'DetGABAAB', 'E', 'E_AMPA_GluSynapse', 'E_NMDA_GluSynapse', 'Exp2Syn', 'ExpSyn', 'FARADAY', 'FInitializeHandler', 'File', 'GAMMA', 'GUIMath', 'Gap', 'GluSynapse', 'Glyph', 'Graph', 'HBox', 'IClamp', 'Ih', 'Im', 'Impedance', 'InhPoissonStim', 'IntFire1', 'IntFire2', 'IntFire4', 'KSChan', 'KSGate', 'KSState', 'KSTrans', 'KTF_cal', 'KTF_can', 'KTF_cat', 'K_Pst', 'K_Tst',
  1. Segmentation fault occurs since it tries to load the same mechanisms twice:
load_mechanisms(".")
# Results in SEGFAULT
# NEURON: The user defined name already exists: Ca
#  near line 0
#  objref hoc_obj_[2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant