-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[lldb, gdb-remote] Bug in SendContinuePacketAndWaitForResponse (with Patch/Fix proposal) #59641
Comments
If anyone has any question, please ask. I will try to assist although my knowledge regarding the gdbremote internals are of course very limited. |
@llvm/issue-subscribers-lldb |
We already have code to prevent this see Lock and ContinueLock classes in Looking at your log snippet, I get the feeling that problems start long before the async resume thread starts doing anything
This doesn't look like a correct response to the
Ditto for jThreadExtendedInfo. Could this be response to
same here
and here
Is this a response to jThreadExtendedInfo instead? |
Hi Pavel, thanks for looking at this so directly. You are absolutely right, the whole log, sent<>recvs, looks mixed up; I did not really notice, because I looked primarily at my own log (the other end, remote). I will investigate this and report back to you. In between, I found&fixed an issue on my end that potentially could have corrupted memory within lldb (maybe). Although I think it was not really related to what I'm reporting, I need to research and come back. Many Thanks |
... ok, tracked one better down. For the moment, please see attached text file, Line 50 is the point where things seem to get out of sync. As of now, I have no idea what on my end could trigger this behaviour. |
Hi again, so ok - I did try to sort out anything that could be related to my end. I also did disable replies for the JSON Thread packets jThreadsInfo and extInfo (still does run fine, I implement all other needed packets). The issue remains. It appears I could narrow it down a bit: [Edit: unfortunately it does not seem to narrow down to this. I'm also experiencing other combinations, but it's the case in 90% of the errors I get] The send<>recv seems really to get out of sync once it sends a qThreadStopInfoX but receives a %T05 stop reply, not a $T05 normal answer. It still runs a bit afterwards but will error out soon. Please see attached log#2 as well. Note: One single point I notice, I get rather often the following message. Although it does not seem to harm: Many Thanks Also attached a large, complete log. Problem arises in line 10584 - 10586. One more Edit: Maybe the problems result from lldb receiving two T05 stopreplies. Confirmed: Strictly preventing the stub from sending more than a single stopreply after one run/continue/vCont will prevent this issue from appearing. So, I think this can be considered as resolved, although an error message (log) or something similar would be great as the problem is hard to identify. One other thing a came across is an assertion in ProcessGDBRemote::WillPublicStop() where const size n is != 0 and when the for loop is iterating, it is 0. So, some other thread must have done something to StructuredData::Array *thread_infos. log2.txt |
Hi all,
I think I discovered an issue in the async thread for GDB remote.
When stepping with high speed (max keyboard rate -> 30 'step' / sec) through a multisthreaded program, it appears that the async thread that calls
SendContinuePacketAndWaitForResponse
sometimes, in very rare occurrences receives not the T05 (stopreply) packet but the normal response for another query packet that is sent (by the other thread). This will of course result in a connection drop.Below is an example log output.
I tried to fix this, please see attached code. However, this fix is not practically applicable I think, as it will drop packet bytes if it receives accidentially a normal response but should receive a T05 packet. However, it solves the problem.
Unfortunately, I am unsure what the root cause of this can be. As far as I can see the threads shall lock the underlying network connection.
Many Thanks
S.
[LOG]
gdbremote_diff.txt
The text was updated successfully, but these errors were encountered: