Opened 7 years ago
Closed 7 years ago
#1605 closed defect (fixed)
Residue.atoms yields corrupted array after residue deleted
Reported by: | Tristan Croll | Owned by: | pett |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | Core | Version: | 0.8 |
Keywords: | Cc: | Tom Goddard | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
If I have a model open:
m = session.models.list()[0] r = m.residues[0] session.models.close([m]) r.atoms.names # yields either an array of garbage or a segmentation fault
Change History (5)
comment:1 by , 7 years ago
Cc: | added |
---|---|
Status: | assigned → feedback |
follow-up: 2 comment:2 by , 7 years ago
I believe it used to be that deleting the C++ side of a Residue (or any State subclass) would delete the _cpp_pointer property of the object. So attempting to use it would cause a Python traceback but wouldn’t completely kill the session. I’ve already fixed the issue in my code, but reported it due to the changed behaviour. Tristan Croll Research Fellow Cambridge Institute for Medical Research University of Cambridge CB2 0XY
comment:3 by , 7 years ago
Status: | feedback → accepted |
---|
That behavior was when Atom/Residues access was through ctypes, and the pointer reference occurred in Python code. Those classes are now implemented in Cython and the pointer access occurs in compiled code. I could put pointer checks into the Cython code so that incorrect user maintenance of Python data produces a traceback instead of crashes/corruption, at an unknown cost in performance.
So: maybe. It would require evaluation.
follow-up: 4 comment:4 by , 7 years ago
This is not good. Crashing on atom attribute access from Python for a deleted atom is likely to cause many errors that cannot be solved because there was no traceback and the deletion might have happened 10 minutes, and 20 command earlier. Not sure what we can do about this, but it needs some consideration.
comment:5 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
The cost of the check seems to be negligible, so I have added it. Unfortunately I can't abstract the pointer check into a cdef routine since those can't raise Python errors if they return non-Python values, so the checks are littered throughout the code.
Hi Tristan,
--Eric