-
-
Notifications
You must be signed in to change notification settings - Fork 182
fix(phpDebug): Make connection init more robust. #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Move 'started' event after Xdebug settings have been set to make sure that 'run' is not executed before settings are processed and make sure that invalid settings don't prevent init from completing. Add some line feeds to output messages.
|
It's easy to test the feature_set problem also by adding an invalid setting to launch.json, like this: |
Unsure about this path. Why do you think is it okay to continue if the features failed? Why shouldn't we error the request (which should result in a toast vs just a log message)? |
Codecov Report
@@ Coverage Diff @@
## master #243 +/- ##
==========================================
- Coverage 69.6% 69.35% -0.26%
==========================================
Files 5 5
Lines 987 992 +5
Branches 160 161 +1
==========================================
+ Hits 687 688 +1
- Misses 300 304 +4
Continue to review full report at Codecov.
|
|
Since the settings are normally not critical for the debugger to work, I thought logging it in debug console would be better than aborting the whole process. I was also thinking that there might be other situations where setting an otherwise valid feature is not allowed for some reason beyond my knowledge, so it might be safer, but if you believe that raising a toast and erroring the request is better, I'd be fine with that too. |
…better. Send error responses instead of just shutting down so that e.g. EADDRINUSE caused by debugger being already active in another window doesn't result in an invalid state.
|
@felixfbecker I think this is the best I can do. The latest commit fixes startup problems e.g. when there's already a debugger running in another window and aborts the debugger if applying xdebugSettings fails. I couldn't find a way to display a nicer toast, though. |
|
@felixfbecker Any chance of getting this merged? |
Move 'started' event after Xdebug settings have been set to make sure that 'run' is not executed before settings are processed and make sure that invalid settings don't prevent init from completing. Add some line feeds to output messages.
The main issue I stumbled on regularly was that because the 'started' event was emitted before the xdebugSettings from launch.json had been processed, occasionally the run command would be sent to Xdebug before the feature_set commands. When the feature_set commands were eventually sent, Xdebug was already in 'stopping' state and returned an error. This error was not caught and resulted in the vscode.InitializedEvent() being missed. This, in turn lead to a situation where the requests were displayed as running in the call stack window but got stuck without completing.