-
Notifications
You must be signed in to change notification settings - Fork 4
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
ECONNRESET Debugging disconnected #189
Comments
The reason for this issue is that the debugger is sending messages to the debugger even though it is exiting. Since this is a multi-threaded issue, it is not reproducible and I have been unable to fix it. When I released 1.10.0, I finally found the cause and fixed it, but it was not enough. I can't promise a reliable fix, but I will add a fix to the suspicious part. Also, the reason why you need to reboot is because the debugger adapter is not terminated properly. It should be possible to fix that as well, but no promises can be made here either. This issue will be closed automatically after the next release, but if the issue recurs, please reopen it. |
This is very annoying because you need to reopen vscode and you lose your ctrl-z history buff, and it has been happening very often. |
I could not find a way to reload the debug adapter. So far it seems the only way is to reopen vscode. Did you have this issue often in |
Yes often, it always happens after a while paused in a breakpoint. |
So it may be a different issue than what I am aware of. I'll think about it after I release the current fix for now. |
This is my settings:
Let me know if you need help testing something! |
Did you set a condition for the breakpoint at this time?
Thanks. I will work on the release as soon as I get time. After that, please check to see if the issue recurs. |
No, i rarely use condition, it always happened with a normal breakpoint.
Yes, I always get a MessageBox, if I do something in my code that crashes the scripts, it's 100% of chance to get:
And then the debugger watch/hover variables don't work anymore. |
If the MessageBox shows up, then it seems to be the same issue I am seeing. Do you remember the contents of the MessageBox? In my case, I get an error about infinite recursion. If it appears, you can copy the contents by pressing Also, is it reproducible? |
The code that causes this issue.
|
Your function doesn't run:
|
Sorry, The above example is for AutoHotkey v2. The above code helped me to identify the cause of the issue, which allowed me to fix this issue completely. I will release a fixed version as soon as I finish the verification process. |
Glad to hear it, will you release the fix soon? I'm getting ECONNRESET with frequency. Also, after v2 be released you will continue to support v1? |
The debugger is basically the same regardless of version, so it should be fixed in v1 as well. However, I have not been able to find any reproducible code in v1, so I have not been able to confirm this. If I can find the time, the release will be done in a few days. |
I've just released it. If you encounter this issue again, please reopen this issue or create a new one. Thanks for the report. |
I understood.
It is recommended that you use the debug directive when sharing issues. Also, please check if the issue still occurs when you break with debug directive. |
I confirmed that it still occurs using the debug directive. |
OK. Please restate the source code using the debug directive. Come to think of it, I was looking at your example, I was thinking, does this error occur in scripts that use the Gui command? I don't debug scripts that use Gui commands very often, so I may not have encountered this error easily. |
What do you mean by scripts that use the Gui command? I noticed one thing now, remember that I said sometimes it launches the script but never starts and keeps on memory forever, and even restarting multiple times it doesn't launch, then I need to reopen VSCode to it start working again? If I remove all breakpoints from the script then it does launch, it i set a breakpoint and try launch again, then the problem return 🤕 |
This means the AutoHotkey Gui command.
Are you referring to this issue? The two topics are currently mixed up and it is difficult to tell which information is about which. So please try to keep it to one topic per issue. |
I have looked for a workaround for the above issue, but it seems that this part is part of the core of VSCode and cannot be solved by extensions, etc. Sorry for not being able to help you. I plan to restructure the debugger in the future, but it will be a year at the earliest as I am currently focusing on creating an AutoHotkey parser and then extension to assist in the development of AutoHotkey. However, I should be able to fix the issue as soon as I can find a way to reliably reproduce the issue. |
Thank you! |
OK. If I come up with an idea to solve this issue, I will work on this branch. |
I have been using the newer version since release, all the issues remain the same :(. |
Thanks for confirming. Can you confirm if the same issue occurs with the Windows SandBox test described below link? |
I cant because I don't have windows pro, sandbox is available only in the Pro version.
Does the master branch has something different from the current version that's on the marketplace? |
I understand. What version of AutoHotkey.exe are you using?
No difference. |
AutoHotkey Unicode 64-bit (1.1.33.10) |
I assume that this issue is caused by the debugger's command being executed after debugging has been disconnected. Since the timing of the issue seems to be when the script is stopped by a breakpoint, I was thinking that the command to the debugger is failing for some reason. In other words, I do not know the cause of the issue at this time. |
Today i got the message without being paused on a breakpoint, it happened after I clicked in the line before Time := (A_TickCount - Time)
If (Time < 1000)
Sleep, 600 |
What did you click? This issue occurs not only when the script is stopped by a breakpoint, but also when the script is stopped by step execution, etc. |
I clicked in the line before |
I don't understand how the issue could occur at that timing. I considered the possibility that the issue occurred because the IntelliSense was executed and the command was sent to the debugger, but pressing the Enter key did not execute the IntelliSense nor did it send the command. In other words, I do not know why this issue occurred at that time. |
I will not be using discord as I want to keep all records on GitHub. |
I confirmed that the issue is being caused because of modifications I did on the source of the AutoHotkey, I'm closing the issue as the extension is not causing it. |
OK. Please let me know if there are any more issues. |
Just a note that I am in the process of porting an AHK 1.1 program into AHK 2 and just started running into this problem as well (I have not done any mods to AHK source). I'm having a lot of trouble tracing the exact part of my code that is causing this since it seems unrelated to breakpoints (it happens even I I have none, and seemingly at random times). I do spin off a lot of threads so might be something there. Anyway, I'll update if I can get to something specific, but just curious as to whether there has been any recent attention to this issue? |
This problem is not reproducible and I do not know for what reason the communication error with the debugger is occurring. After this problem can you successfully start debugging again? The above problem may be fixed by a fix here. |
Generally, just restarting the debug session works. I did have some cases in which I had to actually reboot. If I can narrow things down to an exact cause, I'll update. The code is something like 20,000 lines with quite a few threads and I know as part of the conversion, I'm running into memory write issues all over the place (which are usually picked up by the debugger), but it wouldn't surprise me if one of them is going undetected and killing the process. That's only a guess though at this point. In either case, I'd be lost without this tool, so I'm still extremely thankful for it! |
Thank you! Errors in memory writes were discussed in the following issue. |
Well I managed to eliminate at least one case of the ECONNRESET error which turned-out to be occurring whenever I destroyed one of my Gui windows. Since destroying other windows didn't do this, I looked more critically at the code. There's a ListView owned by the window that acts as a user interface, and it contains a hidden column in which I store the addresses of Map elements using ObjPtrAddRef(). When a user scrolls to a row, the address is read as text then converted back into an object using ObjFromPtr() to fill in various screen elements. What I was not aware of is that reading this back decrements the internal reference counter so I was ending up with invalid memory references when trying to pull the object out a second time. It was under these kinds of conditions that the ECONNRESET would occur. The fix was to use ObjFromPtrAddRef() instead of ObjFromPtr(), but it looks like these sort of bugs are at least one of the things that can cause the ECONNRESET. |
Thanks for the info. It seems that ECONNRESET is caused by a problem on the server side. |
Not a problem. Now that I have a better idea of the sort of conditions that can lead to this I can deal with it. It might be cool if you had the ability to specify the last line of code executed prior to the reset, but beyond that I can see why there probably isn't much you can do about it. |
I am relieved that there was a way to deal with it. I will therefore close this issue again.
Since it is not possible to identify at what point the error occurred or not, it would be difficult to fulfill that request. Conversely, if it is known at what point the error occurred, it is possible to restore the state. (Not possible in the case of ECONNRESET...) In the past, this was impossible due to the specification, so it was given up. Recently, however, the debugger supports exception breakpoints, so it is now possible to determine at what point an error occurred or not. If there is demand, I may implement it. |
While debugging sometimes i get this message:
When i try to run ANY script again, the watch window doesn't show the value of the variables anymore, hovering also stops working, then I need to close all vscode instances and open again.
Any idea why?
The text was updated successfully, but these errors were encountered: