Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Recipes

reszelaz edited this page Sep 9, 2021 · 6 revisions

The purpose of this wiki page is to collect different recipes useful for the Sardana community.

List of Recipes

  • Script to interrogate sardana Servers to extract info about 3rd party plugins (macros or controllers).

  • Script to change the Tango database (TANGO_HOST) in Sardana persistent information e.g., MeasurementGroups's configuration attributes, MacroServer's pre-scan scanshot, etc.

  • When your Sardana server hangs it may be useful to get teh backtrace of all threads to see where they hung. To do it:

    1. Get the Sardana server process id (in this case 1971):
    $:~> ps -ef | grep MacroServer
    zreszela  1971 30230 13 18:33 pts/4    00:00:03 /usr/bin/python3 /home/zreszela/.local/bin/MacroServer py3
    zreszela  2075  2041  0 18:33 pts/5    00:00:00 grep --color=auto MacroServer
    
    1. Attach to the hang process with gdb:
    $:~> gdb -p 1971
    
    1. In gdb issue thread apply all bt
    (gdb) thread apply all bt
    Thread 38 (Thread 0x7fa8e77fe700 (LWP 2047)):
    #0  0x00007fa97d6ae4ff in __libc_recv (fd=29, buf=0x7fa8d8000d58, n=8192, flags=0) at 
    ../sysdeps/unix/sysv/linux/x86_64/recv.c:28
    #1  0x00007fa95d0e30d2 in omni::unixConnection::Recv(void*, unsigned long, unsigned long, unsigned long) () from 
    /usr/lib/libomniORB4.so.1
    #2  0x00007fa95d0a4987 in omni::giopStream::inputMessage() () from /usr/lib/libomniORB4.so.1
    #3  0x00007fa95d0b9d43 in omni::giopImpl12::inputNewServerMessage(omni::giopStream*) () from 
    /usr/lib/libomniORB4.so.1
    #4  0x00007fa95d0b9e70 in omni::giopImpl12::inputMessageBegin(omni::giopStream*, void (*)(omni::giopStream*)) () 
    from /usr/lib/libomniORB4.so.1
    #5  0x00007fa95d0ac961 in omni::GIOP_S::dispatcher() () from /usr/lib/libomniORB4.so.1
    #6  0x00007fa95d0a96c5 in omni::giopWorker::real_execute() () from /usr/lib/libomniORB4.so.1
    #7  0x00007fa95d0a9d4f in omni::giopWorker::execute() () from /usr/lib/libomniORB4.so.1
    #8  0x00007fa95d06002d in omniAsyncWorkerInfo::run() () from /usr/lib/libomniORB4.so.1
    #9  0x00007fa95e99ec4c in Tango::create_PyPerThData (info=...) at utils.cpp:3234
    #10 0x00007fa95d05ff24 in omniAsyncWorkerInfo::run() () from /usr/lib/libomniORB4.so.1
    #11 0x00007fa95d0605ff in omniAsyncWorker::run(void*) () from /usr/lib/libomniORB4.so.1
    #12 0x00007fa95cda16d9 in omni_thread_wrapper () from /usr/lib/libomnithread.so.3
    #13 0x00007fa97d6a5494 in start_thread (arg=0x7fa8e77fe700) at pthread_create.c:333
    #14 0x00007fa97c898acf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
    
    Thread 37 (Thread 0x7fa8e7fff700 (LWP 2039)):
    #0  0x00007fa97c8990c3 in epoll_wait () at ../sysdeps/unix/syscall-template.S:84
    #1  0x00007fa95c91e914 in ?? () from /usr/lib/x86_64-linux-gnu/libzmq.so.5
    [...]
    
    1. In gdb issue thread apply all py-bt

    Remember to have installed:

    • gdb (not gdb-minimal)
    • cppTango debug symbols
    • PyTango debug symbols
    • Python debug symbols
Clone this wiki locally