![]() #Twitch desktop codeI decided to check the code in TwitchAgent responsible for connecting to the pipe to see if I could find an obvious mistake. I also cross-checked the logs of the two processes to make sure they were using the same name to connect to the pipe. Maybe a permission issue? I tried launching the app with administrator rights, but it didn’t change anything. Sure enough, there was a named pipe with the naming pattern seen in the logs. ![]() I suspected earlier that the application was using named pipes, so I started by confirming that in Process Explorer: This seemed to match the logs I saw on TwitchUI! It seemed that the inter-process communication was failing for some reason. Service connection timed out! No connection retries remaining performing safe shutdown. 1 attempts remaining Attempting Desktop Service connection. Service connection timed out! Attempting to reconnect. 2 attempts remaining Attempting Desktop Service connection. After a while, I noticed this sequence of events: Connecting to IPC via pipe Twitch-App-Pipe-21572 Attempting Desktop Service connection. I decided to spend more time analyzing the logs of TwitchAgent, this time ignoring the exceptions. They were logged but properly handled in the code, so I probably was on the wrong track. It looked like all those exceptions were caused by uninitialized variables and were just the consequence of using the default settings in the app. I found other exceptions in the logs, more patching to do?Īfter fixing two more of those exceptions and still seeing no change with the bug, I decided to take a step back. ![]() By chance, the auto-updater logged an error when failing to replace the file but wouldn’t prevent the application from starting.Īfter starting the application with the assembly properly patched, the aforementioned exception was gone. #Twitch desktop how toHow to prevent that? I could find the auto-update code and patch it, but I decided it would be simpler to just remove the write permissions from the file. Clearly, the application was overwriting it at startup, probably because of the auto-update feature. Re-checking the file modification date, I noted it was back to a few weeks ago. Making extra sure to copy the right assembly this time, I tried again and… same result. Maybe I actually forgot to copy the file? Checking the modification date, the file was a few weeks old… Silly me! Was it our culprit? After decompiling the .JavaFinder class and looking at the FindJavas_Win method, I isolated the few calls to Path.Combine: So, what’s the actual bug? When I tried to open the “Mods” tab of the application, the page refused to load, just displaying a loading animation that went on forever: #Twitch desktop trialTo that effect, this article won’t detail the tooling in depth but will retrace as exhaustively as possible the steps I took during the investigation, including the trial and error and false leads. I thought this would be a nice opportunity to explain the mindset and methodology involved in the debugging of an application you know almost nothing about. ![]() Where am I going with all this? A few days ago, I ran into a bug with the Twitch desktop app, and after a few hours and a bit of luck I was able to find the cause and fix it. Sure, this will help, but you won’t go very far with just that skill. Thinking that debugging is about learning how to use WinDbg is like thinking you can become an investigative journalist by learning how to use a camera. Debugging is all about the mindset and the methodology, and the tooling is the simple part. I often had coworkers ask me “what sequence of commands should I type in WinDbg to debug this kind of issue?”, as if debugging was about applying a simple flowchart with a complex tool. Many people that are unfamiliar with debugging tend to think it’s all about mastering difficult and austere tools. ![]() I’ve seen through the years that debugging is often misunderstood. Debugging and fixing the Twitch desktop client ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |