Bug 392392

Summary: Log spam about intermittent failure to load PHD2 guide star images
Product: [Applications] kstars Reporter: Jarno Paananen <jarno.paananen>
Component: generalAssignee: Jasem Mutlaq <mutlaqja>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 3.0.0
Sentry Crash Report:

Description Jarno Paananen 2018-03-27 08:31:59 UTC
When using PHD2 to guide I get this sort of spam in the KStars log:
[2018-03-26T21:42:56.900 EEST INFO ][           org.kde.kstars.fits] - Loading FITS file  "/tmp/kstars/phd2.fits"
[2018-03-26T21:42:56.902 EEST CRIT ][           org.kde.kstars.fits] - "Could not open file /tmp/kstars/phd2.fits. Error could not open the named file"
[2018-03-26T21:43:00.198 EEST INFO ][           org.kde.kstars.fits] - Loading FITS file  "/tmp/kstars/phd2.fits"
[2018-03-26T21:43:03.585 EEST INFO ][           org.kde.kstars.fits] - Loading FITS file  "/tmp/kstars/phd2.fits"
[2018-03-26T21:43:03.586 EEST CRIT ][           org.kde.kstars.fits] - "Could not open file /tmp/kstars/phd2.fits. Error could not open the named file"

I use 3s exposures but the code seems to try to load a fits file every second or so and fails very often. Everything works as such, just annoying and makes the logs harder to find anything from. Current git version compiled on Ubuntu 17.10 x64.
Comment 1 Jasem Mutlaq 2018-07-29 08:16:20 UTC
Git commit 9be2169dc508d6b52dcb1a82b478ea98afa109b6 by Jasem Mutlaq, on behalf of Andy Galasso.
Committed on 29/07/2018 at 08:07.
Pushed by mutlaqja into branch 'master'.

PHD2: honor the "Receive external guide frames" setting. Also, only log event messages from PHD2 when verbose logging is enabled
PHD2: only request a new star image if there is not already an outstanding requests to get the star image
PHD2: additional communication reliablity work

    - prevent problem with intermittent dropped messages by only sending a single JSONRPC request at a time
    - added more debug logging
    - use the documented set of phd2 states; remove custom states and use new state variables for dither state
    - fix error that aborts guiding when a dither is started before the initial settling has completed
    - fix dither timeouts being caused by the dither timer expiring sooner than the timeout sent to PHD2
PHD2: fix error loading PHD2 star image

    In every other frame the temporary .fit file was getting deleted before it could be displayed.

    Also, fix a possible file descriptor leak that could occur if a fitsio function call failed.

PHD2: do not process partial JSON responses, wait until the full resonse (terminated by newline) is received

    The existing code could prematurely process incomplete chunks of phd2 response messages. Now we will
    wait for a full newline-terminated message before processing the response. This also allows us to remove
    a bunch of workaround code that was trying to deal with chopped-up partial messages.

CCMAIL:kstars-devel@kde.org
CCMAIL:rlancaster@gmail.com
FIXED-IN:3.0.0

M  +294  -193  kstars/ekos/guide/externalguide/phd2.cpp
M  +44   -31   kstars/ekos/guide/externalguide/phd2.h

https://commits.kde.org/kstars/9be2169dc508d6b52dcb1a82b478ea98afa109b6