Skip to content

Typhos Suite Segfault on close #610

Description

@ZLLentz

Expected Behavior

No segfaults

Current Behavior

If I open a positioner row widget's expert screen (non-row widget), then close this screen, then close the whole GUI, I get a segfault on the pv cleanup steps.

GDB excerpt when looking at the core dump:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00005633876f5470 in ?? ()
[Current thread is 1 (Thread 0x7f9470233740 (LWP 16795))]
(gdb)
(gdb) py-bt
Traceback (most recent call first):
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/epics/ca.py", line 1896, in clear_subscription
    return libca.ca_clear_subscription(event_id)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/epics/ca.py", line 670, in wrapper
    status = fcn(*args, **kwds)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/epics/ca.py", line 546, in wrapper
    return fcn(*args, **kwds)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/epics/pv.py", line 353, in _clear_auto_monitor_subscription
    ca.clear_subscription(evid)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/epics/pv.py", line 46, in wrapped
    return func(self, *args, **kwargs)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/epics/pv.py", line 1152, in disconnect
    self._clear_auto_monitor_subscription()
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/epics/pv.py", line 46, in wrapped
    return func(self, *args, **kwargs)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/pydm/data_plugins/epics_plugins/pyepics_plugin_component.py", line 248, in                                                                                                                                 close
    self.pv.disconnect()
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/pydm/data_plugins/plugin.py", line 218, in remove_listener
    self.close()
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/pydm/data_plugins/plugin.py", line 317, in remove_connection
    self.connections[connection_id].remove_listener(channel, destroying=destroying)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/pydm/widgets/channel.py", line 164, in disconnect
    plugin.remove_connection(self, destroying=destroying)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/site-packages/pydm/widgets/base.py", line 103, in widget_destroyed
    ch.disconnect(destroying=True)
  <built-in function _qtcore_cleanup>
(gdb) bt
#0  0x00005633876f5470 in ?? ()
#1  0x00007f9459ba11c0 in ca_client_context::eliminateExcessiveSendBacklog (this=0x5633858569e0, guard=..., chan=...) at ../ca_client_context.cpp:795
#2  0x00007f9459ba12e3 in oldChannelNotify::eliminateExcessiveSendBacklog (guard=..., this=0x5633876d6460) at ../oldAccess.h:483
#3  ca_clear_subscription (pMon=0x7f9400002b80) at ../ca_client_context.cpp:765
#4  0x00007f946885da4a in ffi_call_unix64 () from /cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/lib-dynload/../../libffi.so.8
#5  0x00007f946885cfea in ffi_call_int () from /cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.4/lib/python3.9/lib-dynload/../../libffi.so.8
#6  0x00007f946886bf59 in _call_function_pointer (argtypecount=<optimized out>, argcount=1, resmem=0x7fff3fda9440, restype=<optimized out>, atypes=<optimized out>, avalues=<optimized out>, pProc=0x7f9459ba12a0 <ca_clear_subscription(evid)>, flags=4353)
    at /usr/local/src/conda/python-3.9.18/Modules/_ctypes/callproc.c:920

Possible Solution

  • Figure out if/why the pydm channels get deallocated an extra time

Steps to Reproduce (for bugs)

  1. Open a screen with a positioner row widget
  2. Click expert screen
  3. Close expert screen
  4. Close main screen

Context

  • Low impact, just annoying and scary to see a segfault message in your python code
  • I'm testing some other fixes and stumbled upon this one and decided to briefly investigate

Your Environment

pcds-5.8.2

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