| Bug #98854 | session tracker | ||
|---|---|---|---|
| Submitted: | 6 Mar 2020 10:57 | Modified: | 7 Mar 2020 0:45 |
| Reporter: | andy zhang | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
| Version: | 8.0, 5.7 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | mysqltest | ||
[6 Mar 2020 13:46]
MySQL Verification Team
Hi Mr. zhang, Thank you for your bug report. I have checked your analysis and came up to several conclusions. First of all, this is a code that runs only on MS Windows, so I had to correct the entry to that field. Second, your analysis of the loop checking condition is quite correct. Indeed, in other places in the code the '<=' conditions is applied. Verified as reported.
[7 Mar 2020 0:45]
andy zhang
Sinisa, Thanks for your reply. I found the problem on my Linux environment. And I didn't try on MS windows. The problem is a common one. It affects both Windows and Linux, I think.
[9 Mar 2020 12:59]
MySQL Verification Team
I agree. You are quite right. Seemed to me that this is part of the shared memory code, but it is not. Changed OS.

Description: read_ok_ex() function in client.cc has problem on boundary check while doing the list_list reversion at the end. The problem was discovered while I tried to introduce new session trackers, which could have multiple nodes for each command. The information was printed in reverted order. The code snippet is like this if (info) { int itype; for (itype = SESSION_TRACK_BEGIN; itype < SESSION_TRACK_END; <<< It should be for (itype = SESSION_TRACK_BEGIN; itype <= SESSION_TRACK_END; itype++) { if (info->info_list[itype].head_node) { info->info_list[itype].current_node = info->info_list[itype].head_node = list_reverse(info->info_list[itype].head_node); } How to repeat: Not a direct case to report the problem. Suggested fix: In read_ok_ex(), change for (itype = SESSION_TRACK_BEGIN; itype < SESSION_TRACK_END; to for (itype = SESSION_TRACK_BEGIN; itype <= SESSION_TRACK_END;