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

Typhos Suite Segfault on close #610

Open
ZLLentz opened this issue Jun 5, 2024 · 2 comments
Open

Typhos Suite Segfault on close #610

ZLLentz opened this issue Jun 5, 2024 · 2 comments

Comments

@ZLLentz
Copy link
Member

ZLLentz commented Jun 5, 2024

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

@tangkong
Copy link
Contributor

tangkong commented Jun 5, 2024

I assume this is due to pydm trying to remove a connection from a widget that no longer exists? Presumably the one that you closed manually?

This is what the core dump kinda looks like to me but these things are always kinda sneaky

@ZLLentz
Copy link
Member Author

ZLLentz commented Jun 6, 2024

I think so, but I suspect there is something we can do here so that pydm knows not to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants