ComicSansMS / stratcom-vjoy-feeder

Use a SideWinder Strategic Commander as a DirectInput Joystick.
GNU General Public License v3.0
8 stars 0 forks source link

CPU to 50% and RAM climbs to 100% if USB connection lost, doesn't recover on reconnect. #1

Closed ignifluous closed 6 years ago

ignifluous commented 6 years ago

My strategic commander has a slightly flaky usb plug; if usb connection is interrupted, CPU usage for stratcom-vjoy.exe goes above 50%, and begins rapidly consuming more and more memory.

After terminating process, out.log was multi-GB size. After isolating the trigger (usb disconnection), was able to generate a smaller log by quicker exit - after the initialisation success messages, the log is full of the text "Error interacting with Strategic Commander device." repeated thousands of times.

I was able to prevent the memory hogging by setting the out.log file to read-only, however the CPU usage remained unchanged.

No change occurs after reconnecting my device, and the inputs are no longer passed through to vjoy.

After having a look inside stratcom_vjoy_feeder_config.ini, I tried to activate the auto-retry feature, but this appears to be inactive (or didn't make a difference to the behaviour).

As the program appears unable to reacquire the strategic commander once it is reconnected, perhaps a cleaner behaviour would be to post a failure notification (like the ".... is running" notification) to the action center, then cleanly exit. Or, return to the state after a "device failure" notification (i.e. when strategic commander is not connected when stratcom-vjoy.exe is started), so that the "retry device initialisation" option can be manually selected after the device is reconnected.

Either of those would be easier to deal with than the random crashes caused when my system hit 100% CPU and RAM utilisation, heh.

PS: OMG YUSSS thank you so much! I can use my stratcom again! (provided I tape the usb connector to the desk ;-)

Potentially relevant system details: Win10x64 (Version 10.0.17134 Build 17134) vjoy 2.1.8.39 (from here: https://github.com/shauleiz/vJoy/releases/tag/v2.1.8.39) Other connected game controllers: Logitech X52 Pro, and Thrustmaster T-Flight pedals.

ComicSansMS commented 6 years ago

That definitely sounds like a bug in the application.

I will take a look at it in the coming days and report back what I found out. Thanks for reporting this!

ComicSansMS commented 6 years ago

Okay, this was definitely a bug. The application was not handling that situation correctly. I remember that initially I wanted to implement proper support for USB events (so that it can detect automatically whenever the Stratcom is being plugged in or disconnected), but I never got around to doing that and hence also never implemented this error path properly.

I now went for a quick fix, where the application simply reverts back to the error state in that case. I will upload a new build shortly.

ComicSansMS commented 6 years ago

I uploaded a new release which should no longer suffer from this issue.

Please note that I upgraded my build environment since the previous release, so if it complains about a missing VCRUNTIME dll, you should install the appropriate runtime from here (hopefully, this will only be necessary if you are still running an old Windows 7 system).

Please let me know if you run into any more problems.

And I hope you will have lots of fun using the application! 🙂

ignifluous commented 6 years ago

Cool! I'll test this at my end in the next day or so, thanks for the quick fix! I'm using the stratcom as an extra joystick in the DCS flight sim, mainly for controlling radar and sensors, as I've run out of POV hats on my main stick.

ComicSansMS commented 6 years ago

That's exactly what I made this application for.

I use it mainly for playing Elite Dangerous to offload all of the more exotic functionalities from my Hotas. Glad that you find it useful!

ignifluous commented 6 years ago

Great, that seems to have sorted it. Thanks, and again, very nice work.