SGP (Latest beta) / PHD2 / SkyX crash


To be honest not sure where to post this, don’t think this is an actual SGP issue but had some issues last night as was approaching flip, some odd behaviour with SGP where it kept losing the RA/DEC and Time to flip information and then followed by PHD2 no longer sending guide commands and finally a SkyX application crash

As said, not sure where the fault lies here so posting on all relevant forums but would be grateful if you could take a look at the logs and provide any feedback.


Software versions

OS Windwos 8.1 x64

SykX 10.3.0 (Build 8805) (Paramount MX)
PHD2 v2.5.0pre2
TheSky Controlled Driver V 6.0.5391.19493

Log files for SGP, PHD2 and screenhsot of the TheSky Controlled Driver settings

Looking at the SGP log things start to go wrong @ 12/04/2015 01:26:15

[12/04/2015 01:26:15] [DEBUG] [CP Update Thread] Caught exception in CanPierFlipNow : No more threads can be created in the system. (Exception from HRESULT: 0x800700A4) (System.Runtime.InteropServices.COMException (0x800700A4): No more threads can be created in the system. (Exception from HRESULT: 0x800700A4)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at System.Dynamic.ComRuntimeHelpers.CheckIfMissingTypeInfoIsExpected(Int32 hresult, Boolean throwIfMissingExpectedTypeInfo)
at System.Dynamic.ComRuntimeHelpers.GetITypeInfoFromIDispatch(IDispatch dispatch, Boolean throwIfMissingExpectedTypeInfo)
at System.Dynamic.IDispatchComObject.EnsureScanDefinedMethods()
at CallSite.Target(Closure , CallSite , ComObject , Int32 , String )
at CallSite.Target(Closure , CallSite , Object , Int32 , String )
at ASCOM.SoftwareBisque.Telescope.get_SideOfPier())
at ASCOM.DriverAccess.MemberFactory.CheckDotNetExceptions(String memberName, Exception e) in c:\ASCOM Build\Export\ASCOM.DriverAccess\MemberFactory.cs:line 623
at ASCOM.DriverAccess.MemberFactory.GetTargetInvocationExceptionHandler(String memberName, Exception e) in c:\ASCOM Build\Export\ASCOM.DriverAccess\MemberFactory.cs:line 664
at ASCOM.DriverAccess.MemberFactory.CallMember(Int32 memberCode, String memberName, Type[] parameterTypes, Object[] parms) in c:\ASCOM Build\Export\ASCOM.DriverAccess\MemberFactory.cs:line 231
at ASCOM.DriverAccess.Telescope.get_SideOfPier() in c:\ASCOM Build\Export\ASCOM.DriverAccess\Telescope.cs:line 895
at ai.CanPierFlipNow()

In PHD the first error is @ 01:43:15

01:43:15.871 00.010 12944 pulseguide: [80020009] Exception occurred.
01:43:15.871 00.000 12944 Error thrown from scope_ascom.cpp:586->ASCOM Scope: pulseguide command failed: (TheSkyXAdaptor.DirectGuide.1) COleException: No more threads can be created in the system.

(800700A4) SCODE: 800700a4.
01:43:15.871 00.000 12944 Error thrown from scope.cpp:626->guide failed

Then at 12/04/2015 01:54:00 the SkyX crashes, cant find any logs for the SkyX so only this from the event log.

Faulting application name: TheSkyX.exe, version:, time stamp: 0x552340de
Faulting module name: TheSkyX.exe, version:, time stamp: 0x552340de
Exception code: 0xc0000005
Fault offset: 0x00f72b7e
Faulting process id: 0x1730
Faulting application start time: 0x01d072ebcb1eddeb
Faulting application path: C:\Program Files (x86)\Software Bisque\TheSkyX Professional Edition\TheSkyX.exe
Faulting module path: C:\Program Files (x86)\Software Bisque\TheSkyX Professional Edition\TheSkyX.exe
Report Id: 678981e7-e0ae-11e4-82ee-f81654cd60c6
Faulting package full name:
Faulting package-relative application ID:

Sounds like something went crazy and was hogging up a lot of threads on your system.

If you can make this happen again, open up the Task Manager and go to the “Details” tab. Then right click on the header at the top and choose “Select Columns” and choose “Threads” from the list.

Then order that list by the threads and see what is consuming them.

From the SGP side “CanPierFlipNow” doesn’t actually spawn any additional threads. But it does make a couple of calls to the ASCOM driver and it’s possible that the driver may be creating a thread or the resulting call to TheSkyX is creating a thread.

In other words it’s difficult to tell what’s going on here. It may be worth opening up the Task Manager while all this is running just to see if the thread count keeps climbing in one of those applications.


This may be the same issue as discussed here:

and here:!topic/open-phd-guiding/5YKW5-J4Grk

and toward the end of this SGP thread:

It was found by Chris Woodhouse (Buzz) and appears to be a bug in the latest TSX (8805) build.

Thanks for looking Jared, I do suspect the latest TSX build as being the source of the issue but will keep an eye on it and check. Never seen anything like this before and done many longer runs.

I did think this maybe linked to the recent posts from Buzz as we basically run the same kit, maybe Tuesday before I can next get out but will check on resources next time.

I thought they were may be linked but decided to start new threads, if get similar problems next time out will back out to the previous TSX version.



For what it’s worth,

A 32 bit OS can typically support about 2,000 threads OS wide and a 64 bit OS can support about 6,600 threads (off the shelf). These numbers can be increased through various user fiddling. SGPro runs between 27 and 30.

C++/C# Programming makes up some of the day job so did think it was very unlikely the cause was SGP, it more spotted the issue but leaning towards regression in TSX as the root cause though SB will need to look and also need to see if the problem can be reproduced.

On the plus side when all was working slews and centre here worked perfectly.


FWIW, I ran for 4 hours last night, on my MX and TSX build 8670, using Chris’ ASCOM driver and PHD2 pre 3 - I was using DirectGuide and was dithering between exposures and pausing during focusing.
No issues to report. In order to get back to build 8670, I had to uninstall and re-install a full TSX load and then apply the daily build, which thankfully, I had saved to disk. A bit clumsy, but it worked.

Seems a long way round a short trip, normally just copy back the the 3 files from the backup folder, did you try that?

@trevorn - Thanks!! I did not know that one at all. Cool, I have helped with Peter’s lodestar issue and you have found a considerably easier way to switch TSX versions without resorting to drastic measures.
This is what I like about Astrophotography, the collaboration between folks that will likely never meet.