Welcome, Guest
Username: Password: Remember me
20 Aug 2017
INDI development team is happy to announce the release of INDI Library v1.5.0. This new exciting release builds on the maturity of INDI Library and comes with many new supported devices and fixes for existing drivers.
Read More...
  • Page:
  • 1

TOPIC: KStars hangs when stopping my indi driver in FIFO indi server.

KStars hangs when stopping my indi driver in FIFO indi server. 3 months 4 days ago #19206

  • kbrown
  • kbrown's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
So I've coded an indi driver for my arduino based DIY focuser. It works well except when I stop the driver in my server that is running in FIFO mode. Kstars hangs at this point. This only happens if I've actually connected to the device at least once. The starting and stopping the driver without connecting to the device works as expected. The UI panels in KStars update just as they should. But when I have connected (and optionally disconnected) to the device, KStars will hang upon stopping the driver in the server. I've noticed this same behaviour with some other drivers too like indi_eqmod_telescope for example. Some other drivers don't experience this same problem like indi_atik_ccd for example. I'm wondering if there's some clean up stuff I need to code into my driver upon disconnect to get rid of this problem? It's not really a show stopper but would be nice to get it working smoothly. Any ideas?

EDIT: detail of my system:
- Indi server is running on a Raspberry Pi 2 using fairly recent indi build from git.
- Kstars (bleeding) is running on my ubuntu 16.04 laptop. Also fairly recent indi build from git.

Cheers,
Kari

Please Log in or Create an account to join the conversation.

Last Edit: by kbrown.

KStars hangs when stopping my indi driver in FIFO indi server. 3 months 4 days ago #19218

Please Log in or Create an account to join the conversation.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?

KStars hangs when stopping my indi driver in FIFO indi server. 3 months 1 day ago #19295

  • kbrown
  • kbrown's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
I am not entirely sure but to me this seems more like a KStars / Ekos problem. The indi server keeps running and I can re-connect to it after I've killed and restarted KStars. Happy to help to debug this if you have any ideas where to start looking?

Cheers,
Kari

Please Log in or Create an account to join the conversation.

KStars hangs when stopping my indi driver in FIFO indi server. 2 months 4 weeks ago #19345

  • kbrown
  • kbrown's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
In an attempt to get more information of what's going on I ran KStars in gdb and took a back trace after it got unresponsive. Here's what I did:

On my Raspberry Pi
- Start indiserver in FIFO mode
- Start the indi_gpsd, indi_eqmod_telescope, indi_atik_ccd and indi_primefocus drivers. The last one is my own.

On my ubuntu laptop:
- Start KStars in gdb
- Connect to the indiserver
- Connect to indi_primefocus
- Disconnect indi_primefocus

Everything up to here works as expected. Now if I stop the indi_primefocus driver in the server, it's UI controls are removed from ekos and kstars indi control panel but the program will hang. KStars becomes totally unresponsive. At this point I hit ctrl+c in gdb and dumped out the back trace:
^C
Thread 1 "kstars" received signal SIGINT, Interrupt.
0x00007ffff2fd098d in pthread_join (threadid=140736607545088, thread_return=0x0)
    at pthread_join.c:90
90	pthread_join.c: No such file or directory.
(gdb) bt
#0  0x00007ffff2fd098d in pthread_join (threadid=140736607545088, thread_return=0x0)
    at pthread_join.c:90
#1  0x00007ffff2163b97 in std::thread::join() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x0000000100602d3f in INDI::BaseClient::disconnectServer() ()
#3  0x0000000100234648 in DriverManager::disconnectRemoteHost (this=0x1036dec30, 
    dv=dv@entry=0x103881cc0)
    at /build/kstars-bleeding-FmmvQZ/kstars-bleeding-17.04+201708262117~ubuntu16.04.1/kstars/indi/drivermanager.cpp:759
#4  0x00000001002d7a84 in EkosManager::cleanDevices (this=this@entry=0x1035c3840, 
    stopDrivers=stopDrivers@entry=true)
    at /build/kstars-bleeding-FmmvQZ/kstars-bleeding-17.04+201708262117~ubuntu16.04.1/kstars/ekos/ekosmanager.cpp:816
#5  0x00000001002d7ef5 in EkosManager::cleanDevices (stopDrivers=true, this=0x1035c3840)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qmap.h:1020
#6  EkosManager::removeDevice (this=0x1035c3840, devInterface=0x103474390)
    at /build/kstars-bleeding-FmmvQZ/kstars-bleeding-17.04+201708262117~ubuntu16.04.1/kstars/ekos/ekosmanager.cpp:1250
#7  0x000000010021253a in EkosManager::qt_static_metacall (_o=<optimised out>, _c=<optimised out>, 
    _id=<optimised out>, _a=<optimised out>)
    at /build/kstars-bleeding-FmmvQZ/kstars-bleeding-17.04+201708262117~ubuntu16.04.1/obj-x86_64-linux-gnu/kstars/moc_ekosmanager.cpp:316
#8  0x00007ffff3ee0d2a in QMetaObject::activate(QObject*, int, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00000001001f4c22 in INDIListener::deviceRemoved (this=this@entry=0x1037cd780, 
    _t1=0x103474390)
    at /build/kstars-bleeding-FmmvQZ/kstars-bleeding-17.04+201708262117~ubuntu16.04.1/obj-x86_64-linux-gnu/kstars/moc_indilistener.cpp:449
#10 0x000000010025246f in INDIListener::removeDevice (this=0x1037cd780, dv=0x7fffb8001e70)
    at /build/kstars-bleeding-FmmvQZ/kstars-bleeding-17.04+201708262117~ubuntu16.04.1/kstars/indi/indilistener.cpp:209
#11 0x000000010021582c in INDIListener::qt_static_metacall (_o=<optimised out>,

I don't know what this could imply but if I kill this instance of KStars and start it up again, I am able to connect to the server and everything works as expected. Is there a way to get more debug information than this or do I need to compile KStars myself?

Ta,
K

Please Log in or Create an account to join the conversation.

Last Edit: by kbrown.

KStars hangs when stopping my indi driver in FIFO indi server. 2 months 4 weeks ago #19346

  • kbrown
  • kbrown's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
Dug a little deeper. I compiled and installed KStars from source in order to get more detailed debug info. It seemed odd to me that it wanted to disconnect from the server after removal of the driver so as a temporary workaround I just commented out a couple of lines in EkosManager::cleanDevices() and it seems to work better. Not sure what else this breaks but at least it does not hang any more. Here's the modified function:
void EkosManager::cleanDevices(bool stopDrivers)
{
    if (ekosStartingStatus == EKOS_STATUS_IDLE)
        return;

    INDIListener::Instance()->disconnect(this);
    DriverManager::Instance()->disconnect(this);

    if (managedDrivers.isEmpty() == false)
    {
        if (localMode)
        {
            if (stopDrivers)
                DriverManager::Instance()->stopDevices(managedDrivers);
        }
        else
        {
            // TEMPORARILY COMMENTED THESE TWO LINES OUT
            // if (stopDrivers)
            //     DriverManager::Instance()->disconnectRemoteHost(managedDrivers.first());

            if (remoteManagerStart && currentProfile->INDIWebManagerPort != -1)
            {
                INDI::WebManager::stopProfile(currentProfile);
                remoteManagerStart = false;
            }
        }
    }

    reset();

    profileGroup->setEnabled(true);

    appendLogText(i18n("INDI services stopped."));
}

Please Log in or Create an account to join the conversation.

KStars hangs when stopping my indi driver in FIFO indi server. 2 months 4 weeks ago #19358

well, it seems there is deadlock happening between the client manager and Ekos, but I wasn't able to reproduce it using the simulators. I will try later with a "real" focuser and will see if that makes any difference.

Please Log in or Create an account to join the conversation.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?

KStars hangs when stopping my indi driver in FIFO indi server. 2 months 4 weeks ago #19359

  • kbrown
  • kbrown's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
Thanks Jasem. I'll see if I can reproduce this with my other devices too. I have a feeling eqmod telescope might do it as well. Will confirm later.

Ta,
K

Please Log in or Create an account to join the conversation.

KStars hangs when stopping my indi driver in FIFO indi server. 2 months 3 weeks ago #19417

  • kbrown
  • kbrown's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
Just tested with indi_eqmod_telescope driver and it does the same thing. No other drivers were running in this test. Here's the back trace that looks similar to the one above:
^C
Thread 1 "kstars" received signal SIGINT, Interrupt.
0x00007ffff2fd098d in pthread_join (threadid=140736481720064, thread_return=0x0) at pthread_join.c:90
90	pthread_join.c: No such file or directory.
(gdb) bt
#0  0x00007ffff2fd098d in pthread_join (threadid=140736481720064, thread_return=0x0) at pthread_join.c:90
#1  0x00007ffff24b7b97 in std::thread::join() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x000000010082bb2f in INDI::BaseClient::disconnectServer (this=0x103a78f70)
    at ...git_repos/indi/libindi/libs/indibase/baseclient.cpp:274
#3  0x00000001002df974 in DriverManager::disconnectRemoteHost (this=0x103a8fba0, dv=0x103c6f5f0)
    at ...git_repos/kstars/kstars/indi/drivermanager.cpp:759
#4  0x00000001003b662b in EkosManager::cleanDevices (this=0x10395cd80, stopDrivers=true)
    at ...git_repos/kstars/kstars/ekos/ekosmanager.cpp:810
#5  0x00000001003b8e60 in EkosManager::removeDevice (this=0x10395cd80, devInterface=0x103fd9240)
    at ...git_repos/kstars/kstars/ekos/ekosmanager.cpp:1247
#6  0x00000001002955a6 in EkosManager::qt_static_metacall (_o=0x10395cd80, _c=QMetaObject::InvokeMetaMethod, _id=15, _a=0x7fffffffd220)
    at ...git_repos/kstars/build/kstars/moc_ekosmanager.cpp:316
#7  0x00007ffff3ee0d2a in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00000001002a3a96 in INDIListener::deviceRemoved (this=0x103b5bc10, _t1=0x103fd9240)
    at ...git_repos/kstars/build/kstars/moc_indilistener.cpp:449
#9  0x0000000100304b46 in INDIListener::removeDevice (this=0x103b5bc10, dv=0x7fffbc002010)
    at ...git_repos/kstars/kstars/indi/indilistener.cpp:209
#10 0x00000001002a2f7d in INDIListener::qt_static_metacall (_o=0x103b5bc10, _c=QMetaObject::InvokeMetaMethod, _id=21, _a=0x7fffc3ff22c0)
    at ...git_repos/kstars/build/kstars/moc_indilistener.cpp:190
#11 0x00007ffff3ee1c01 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff4c2005c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#13 0x00007ffff4c25516 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#14 0x00007ffff3eb238b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff3eb4786 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007ffff3f083c3 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007fffee451197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007fffee4513f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007fffee45149c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007ffff3f087cf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x00007ffff3eafb4a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007ffff3eb7bec in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#23 0x00000001000c46fb in main (argc=1, argv=0x7fffffffdbe8) at ...git_repos/kstars/kstars/main.cpp:316

Not sure if I'm able to dig deeper but I will try...

EDIT: Just tried the same thing with indi_gpsd and indi_atik_ccd drivers which do not seem to suffer from this problem.
One common thing with my focuser driver and the eqmod is that they're both interfaced via /dev/ttyUSBX where as the other two are not. Not sure if this makes any difference though...

Ta,
K

Please Log in or Create an account to join the conversation.

Last Edit: by kbrown.
  • Page:
  • 1
Time to create page: 0.224 seconds

Login

3rd Party

Choose from the numerous 3rd party INDI drivers to suit your needs!

Got Problem?

Check out the FAQ, the forum, and the bug tracking system to resolve any issues you might have!
You can also subscribe to INDI newsletter and development mailing lists to get the latest updates on INDI!


Gallery

Replica

Why INDI

Replica