Repository navigation
Closed
Labels
3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifeOS-windowseasytestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2019-10-03.15:31:37.450>
created_at = <Date 2019-04-19.15:52:37.352>
labels = ['easy', 'type-bug', '3.8', '3.9', '3.7', 'tests', 'OS-windows']
title = 'regrtest: win_utils decodes typeperf output from the wrong encoding (test suite broken due to cpu usage feature on win 10/ german)'
updated_at = <Date 2020-04-14.23:05:24.337>
user = 'https://github.com/LorenzMende'bugs.python.org fields:
activity = <Date 2020-04-14.23:05:24.337>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2019-10-03.15:31:37.450>
closer = 'vstinner'
components = ['Tests', 'Windows']
creation = <Date 2019-04-19.15:52:37.352>
creator = 'LorenzMende'
dependencies = []
files = ['48406']
hgrepos = []
issue_num = 36670
keywords = ['patch', 'easy', 'newcomer friendly']
message_count = 35.0
messages = ['340547', '340548', '340550', '340551', '340562', '340575', '340576', '340632', '340797', '340806', '344293', '345076', '348719', '353554', '353555', '353556', '353660', '353664', '353667', '353669', '353670', '353731', '353732', '353768', '353770', '353772', '353779', '353783', '353786', '353832', '353850', '353853', '353857', '353860', '366462']
nosy_count = 12.0
nosy_names = ['paul.moore', 'db3l', 'vstinner', 'tim.golden', 'zach.ware', 'eryksun', 'steve.dower', 'ammar2', 'miss-islington', 'LorenzMende', 'skoslowski', 'heckad']
pr_nums = ['15488', '16456', '16511', '16513', '16514', '16530', '16537', '16538', '16550', '16553', '16554', '16555', '16556', '16559', '16560', '16562']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue36670'
versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']Metadata
Metadata
Assignees
Labels
3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of lifeOS-windowseasytestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
LorenzMende commentedon Apr 19, 2019
I see two possible solutions to this issue.
environment:
Windows 10 x64, 1809, german
cpython @e16467af0bfcc9f399df251495ff2d2ad20a1669
commit of assumed root cause of https://bugs.python.org/issue34060
ammaraskar commentedon Apr 19, 2019
What does
typeperf "\System\Processor Queue Length" -si 1actually return on your non-English system?Does it just return an error with the counter's name or is the umalet just in the first header line, i.e this one for me:
"(PDH-CSV 4.0)","\\MSI\System\Processor Queue Length"
If it's the latter then I think the correct fix would be to figure out what encoding typeperf is outputting in and then just decode with that.
LorenzMende commentedon Apr 19, 2019
Hi Ammar, you are correct.
typeperf returns:
P:\Repos\CPython\cpython>typeperf "\System\Prozessor-Warteschlangenlänge" -si 1
"(PDH-CSV 4.0)","\\ZERO\System\Prozessor-Warteschlangenlänge"
"04/19/2019 19:09:14.510","0.000000"
"04/19/2019 19:09:15.514","0.000000"
So even with correct counter name the outpu needs to be decoded correctly.
I already got a solution to get the location specific counter name from registry - if it helps I'll commit it.
ammaraskar commentedon Apr 19, 2019
Thank you, could you also share the output if you just give it the English name of the counter?
terryjreedy commentedon Apr 20, 2019
'crash' mean *nix coredump or Windows equivelent, rather than traceback.
zooba commentedon Apr 20, 2019
It'll probably be mbcs or oem encoding. Certainly not UTF-8
eryksun commentedon Apr 20, 2019
Unless the system locale's codepage is set to UTF-8 in Windows 10.
I stepped through this in the debugger. When writing to a pipe, typeperf.exe calls WideCharToMultiByte(CP_OEMCP, ...), so it's "oem".
zooba commentedon Apr 22, 2019
If the code page is set to UTF-8 then mbcs will still be the right encoding :)
LorenzMende commentedon Apr 24, 2019
Sorry, was off some days. I tried to decode the output with mbcs, solves the issue partly - the counter name is still wrong.
Was able to pick the localization specific counter name from registry and use it for the typeperf.
But the tests fail after several seconds with Broken Pipe Error of the command_stdout pipe.
@ammar - why is the handle closed in start()? If I uncomment it, the load tracker workks fine.
Added the fixed file, may someone evaluate the solution on another windows localization?
22 remaining items
db3l commentedon Oct 2, 2019
Just an FYI that this change is generating warnings on my Windows 10 buildbot with some regularity about a failure to parse testperf output, such as:
Warning -- Failed to parse typeperf output: '"10/01/2019 07:58:50.056"'
from https://buildbot.python.org/all/#/builders/217/builds/487
Now, clearly there's no queue length in that output so the parsing warning is accurate, but does the overall build have to reflect a warning in such cases, given that it's just a test harness issue, and not anything going wrong with the actual tests? Previously any such cases would be ignored silently, so this probably isn't a new issue but just one that is now shows up as an overall build warning.
I don't know why both fields aren't present although it seems plausible that it's just a partial line from the I/O (I don't think it guarantees it receives full lines), and the queue length field would appear on the following read.
vstinner commentedon Oct 2, 2019
Warning -- Failed to parse typeperf output: '"10/01/2019 07:58:50.056"'
Aha, interesting. I added a warning to debug the code.
The build is marked as "warning" (orange) which is different than "fail" (red). Warnings are used to detect bugs or interesting issues, but not considered as a regression.
Right, the code doesn't ensure that a line ends with a newline character. Could you try to run manually the following command to check its output?
typeperf "\System\Processor Queue Length" -si 1
Maybe uncomplete lines should be buffered in read_output().
db3l commentedon Oct 2, 2019
Oh, I agree it's just a warning, and I suspect few people look into warnings, but since it's not from an actual test, I'm not sure the overall build should be flagged.
The manual typeperf looks fine, but there's no way I could tell visually how the I/O is being done under the covers. My bet is typeperf is probably issuing multiple output calls, one for the leading timestamp and then one for each value. So regrtest just happens to interleave its own read in between the two. The subsequent read would then get the trailing ",####" which the current code would parse normally as it only cares about the second field. In which case it's not even affecting the load monitoring, other than the warning message.
I suspect it's happening on the Windows 10 buildbot as the machine is reasonably fast. But to your earlier comment about things just working previously, I'm not sure there's that much value in adding code to deal with this case.
I'd probably just remove the warning to restore the earlier behavior. The current code still ignores other issues like an actual read failure in read_output. Or, if there's a way to generate the message without it being considered an overall test build warning, that would work too.
db3l commentedon Oct 2, 2019
I've confirmed the partial read with some local modifications, and the failures are always split between time stamp and value:
Warning -- Failed to parse typeperf output: '"10/02/2019 17:42:26.229"'
0.0
Warning -- Missing first field: ,"0.000000"
0.0
Adding multiple variables to the typeperf command can vary the split position, but I've only seen it at a variable boundary (starting with the comma). So I'm guessing with the current implementation the above is probably the only point where the I/Os can be interleaved.
Also, CRLF seems to only appear at the start of each read, never at the end. You can see that behavior interactively too where the cursor waits at the end of the line between samples. So changes to wait for a complete line to be read would also delay load values by one sample interval.
So I'm thinking just reverting to silently ignoring this case is probably simplest.
vstinner commentedon Oct 2, 2019
Ok, I managed to reproduce the bug using this change:
I wrote PR 16550 to handle partial lines.
vstinner commentedon Oct 2, 2019
New changeset 3e04cd2 by Victor Stinner in branch 'master':
bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550)
3e04cd2
vstinner commentedon Oct 3, 2019
New changeset c65119d by Victor Stinner in branch 'master':
bpo-36670: Enhance regrtest WindowsLoadTracker (GH-16553)
c65119d
vstinner commentedon Oct 3, 2019
New changeset 098e256 by Victor Stinner in branch 'master':
bpo-36670: Enhance regrtest (GH-16556)
098e256
vstinner commentedon Oct 3, 2019
New changeset de3195c by Victor Stinner in branch '3.8':
[3.8] bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550) (GH-16560)
de3195c
vstinner commentedon Oct 3, 2019
Thanks for the bug report. I was impacted by the bug with my French locale as well.
I pushed a fix based on Lorenz Mende's work, with minor changes. I also enhanced WindowsLoadTracker to handle partial write and report parsing errors as warnings rather than exception.
I pushed other changes to enhance regrtest in general.
The load average is not updated every second and it's value is initialized from the arithmetic mean of the first 5 values of the Processor Queue Length.
miss-islington commentedon Oct 3, 2019
New changeset f9016e5 by Miss Islington (bot) in branch '3.7':
[3.8] bpo-36670, regrtest: Fix WindowsLoadTracker() for partial line (GH-16550) (GH-16560)
f9016e5
vstinner commentedon Apr 14, 2020
New changeset b894b66 by Victor Stinner in branch '3.7':
Update libregrtest from master (GH-19517)
b894b66