You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test-cli-node-options has been failing a lot on arm lately in CI. I assume it's the bug reported in #21383 ("make test: use after free: parallel/test-cli-node-options").
easily recreated if you run this a hundred times in freebsd
node --perf-basic-prof -e 'console.log("B")'
#
# Fatal error in , line 0
# Check failed: (perf_output_handle_) != nullptr.
#
#
#
(gdb) where
#00x00000000015a8eb2 in v8::base::OS::Abort ()
#10x0000000000f79516 in v8::internal::PerfBasicLogger::PerfBasicLogger ()
#20x0000000000f7fb92 in v8::internal::Logger::SetUp ()
#30x0000000000f5b25c in v8::internal::Isolate::Init ()
#40x000000000117dd3f in v8::internal::Snapshot::Initialize ()
#50x0000000000ace03b in v8::Isolate::Initialize ()
#60x00000000008fba32 in node::NewIsolate ()
#70x00000000008fdc88 in node::Start ()
#80x00000000008fbfdb in node::Start ()
#90x00000000008ae095 in _start ()
#100x00000008022f0000 in ?? ()
#110x0000000000000000 in ?? ()
(gdb)
Am I reading this correctly, its pid reuse which is causing the tmpfile name collision? Is it possible to configure freebsd to use a larger pid space so the reuse doesn't occur during our tests runs? And does this point to a problem with the tempfile name generation?
@sam-github - yes, this is an issue with PIDs in small ranges that get re-used often, but when composed into file names that is being used by different users causes permission issues, leading to temp file generation failure.
I don't know the admin command to change the PID pattern, and do not have the permission to try that even if I know; though widening the PID even by one digit should resolve collision I guess.
on a side note: though I recreated this in __freebsd__ and the issue is 100% same with the original report, the original failure was reported in arm. So I am wondering whether fixing it at the host level would be the right thing or not.
Perhaps the test should use the env to set the temp directory to per-user location, like $PWD/out/Release, to avoid conflict? Perhaps in tools/test.py?
Though I'm a bit confused, are multiple users running the node tests at the same time? If there are multiple parallel test runs by the same user, permission problems shouldn't occur, though other conflicts could.
for the first one (setting TMPDIR prior to the test) I tried; but does not look like being honored; the '/tmp' location seem to be assumed in the v8 code.
@Trott This seems like it may or may not be a V8 bug. Is there any machine on which this is reproduces sufficiently often so that one could debug this?
If we're seeing errors limited to a single machine then we might be running into hardware problems, we've been tracking these but never been able to nail it firmly down #23913
parallelism isn't a problem on these machines fwiw
I'm not saying that parallelism is necessarily the issue with these tests, but the history of our test issues on CI suggests that a high processor count is suggestive of parallelism being the problem, not the other way around.
When there are tests that fail when run at the same time as lots of other tests, it tends to show up on machines in CI that have very high processor counts. Counterintuitive at first, but then when you start troubleshooting, it becomes more obvious: The processor count determines how many tests are run at the same time. If you are running 96 tests at once, you are far more likely to hit two tests that have a previously-unrecognized incompatibility. If you run 4 tests at once, this is far less likely.
Fwiw, I’m currently trying to debug this on the machine itself, and the test also fails rather frequently when it’s being run as a standalone script, without other tests being run at the same time.
Fwiw, I’m currently trying to debug this on the machine itself, and the test also fails rather frequently when it’s being run as a standalone script, without other tests being run at the same time.
In response to the "Fwiw", I'd say that's worth an awful lot. 😀
Oh, yeah, and the results from #26994 sure seem to rule out parallelism being the problem here too. Given that PR, I probably shouldn't have said anything at all. Sorry about the distraction! (EDIT: Although it seemed to feel like the right explanation with the PID re-use thing....)
Although it seemed to feel like the right explanation with the PID re-use thing
Yup, that’s it. All in all, the issue doesn’t appear to be super complicated:
When running Node.js with --perf-basic-prof, like this test does (via NODE_OPTIONS, but that’s not relevalent), it will try to create a file named /tmp/perf-${pid}.map.
If the file already exists and is not writable, the CHECK in L299 crashes, causing these failures. If the file does not exist, it is created, and never cleaned up.
The host to which I have SSH access has a PID range from 0 to 100000, and currently has 52453 files of that format in /tmp/, of which 50016 are owned by root; meaning, it will fail about 50 % of the time, because tests running under the iojs user doesn’t have permissions to overwrite these files.
Partly, this is a build WG problem, because sometimes tests run as root and sometimes as iojs, leading to permissions problems.
Partly, this is a problem with our test files themselves; we don’t clean up these files after they have been created.
Partly, this is a V8 problem, because hard crashing when the perf log file isn’t writable and not providing any more information isn’t a great solution.
The only circumstances in which tests are run as root in our infra is if they are run manually. We run everything as 'iojs' and it never has sudo access. So I'm suspecting this is a problem with our manual access processes, maybe we need to make it clear that anyone given manual access needs to run tests as 'iojs' and the root SSH access is mainly for convenience. Or maybe we need to give only 'iojs' SSH access most of the time instead?
I think this can be closed because the running-tests-as-root thing isn't something that happens in regular CI runs, but is operator error? Or is that letting ourselves off the hook too easily?
Activity
Trott commentedon Dec 14, 2018
And again. Probably time to mark this as flaky. Will open a PR.
test-packetnet-ubuntu1604-arm64-2
https://ci.nodejs.org/job/node-test-commit-arm/20790/nodes=ubuntu1604-arm64/consoleText
test: mark test-cli-node-options flaky on arm
test: mark test-cli-node-options flaky on arm
test: mark test-cli-node-options flaky on arm
gireeshpunathil commentedon Jan 10, 2019
easily recreated if you run this a hundred times in freebsd
node --perf-basic-prof -e 'console.log("B")'this corresponds to:
node/deps/v8/src/log.cc
Lines 294 to 296 in a6f69eb
truss output showed this:
so this is basically a temporary name collision. Unlikely to happen on production. One of:
PerfBasicLogger::PerfBasicLogger)sam-github commentedon Jan 10, 2019
Am I reading this correctly, its pid reuse which is causing the tmpfile name collision? Is it possible to configure freebsd to use a larger pid space so the reuse doesn't occur during our tests runs? And does this point to a problem with the tempfile name generation?
gireeshpunathil commentedon Jan 10, 2019
@sam-github - yes, this is an issue with PIDs in small ranges that get re-used often, but when composed into file names that is being used by different users causes permission issues, leading to temp file generation failure.
I don't know the admin command to change the PID pattern, and do not have the permission to try that even if I know; though widening the PID even by one digit should resolve collision I guess.
gireeshpunathil commentedon Jan 10, 2019
on a side note: though I recreated this in
__freebsd__and the issue is 100% same with the original report, the original failure was reported inarm. So I am wondering whether fixing it at the host level would be the right thing or not.sam-github commentedon Jan 10, 2019
Perhaps the test should use the env to set the temp directory to per-user location, like
$PWD/out/Release, to avoid conflict? Perhaps in tools/test.py?Though I'm a bit confused, are multiple users running the node tests at the same time? If there are multiple parallel test runs by the same user, permission problems shouldn't occur, though other conflicts could.
gireeshpunathil commentedon Jan 10, 2019
I don't know; let us ask @nodejs/testing and @Trott
gireeshpunathil commentedon Jan 10, 2019
for the first one (setting
TMPDIRprior to the test) I tried; but does not look like being honored; the '/tmp' location seem to be assumed in the v8 code.19 remaining items
addaleax commentedon Mar 31, 2019
@Trott This seems like it may or may not be a V8 bug. Is there any machine on which this is reproduces sufficiently often so that one could debug this?
Trott commentedon Mar 31, 2019
@addaleax test-packetnet-ubuntu1604-arm64-2 is the one it's happened on the last few times so that might be a good candidate.
rvagg commentedon Apr 1, 2019
parallelism isn't a problem on these machines fwiw
@addaleax I've added you to root@147.75.74.174 nodejs/build#1747
If we're seeing errors limited to a single machine then we might be running into hardware problems, we've been tracking these but never been able to nail it firmly down #23913
Trott commentedon Apr 3, 2019
https://ci.nodejs.org/job/node-test-commit-freebsd/25352/nodes=freebsd11-x64/consoleFull
test-digitalocean-freebsd11-x64-1
Trott commentedon Apr 3, 2019
I'm not saying that parallelism is necessarily the issue with these tests, but the history of our test issues on CI suggests that a high processor count is suggestive of parallelism being the problem, not the other way around.
When there are tests that fail when run at the same time as lots of other tests, it tends to show up on machines in CI that have very high processor counts. Counterintuitive at first, but then when you start troubleshooting, it becomes more obvious: The processor count determines how many tests are run at the same time. If you are running 96 tests at once, you are far more likely to hit two tests that have a previously-unrecognized incompatibility. If you run 4 tests at once, this is far less likely.
addaleax commentedon Apr 3, 2019
Fwiw, I’m currently trying to debug this on the machine itself, and the test also fails rather frequently when it’s being run as a standalone script, without other tests being run at the same time.
Trott commentedon Apr 3, 2019
In response to the "Fwiw", I'd say that's worth an awful lot. 😀
Trott commentedon Apr 3, 2019
Oh, yeah, and the results from #26994 sure seem to rule out parallelism being the problem here too. Given that PR, I probably shouldn't have said anything at all. Sorry about the distraction! (EDIT: Although it seemed to feel like the right explanation with the PID re-use thing....)
addaleax commentedon Apr 3, 2019
Yup, that’s it. All in all, the issue doesn’t appear to be super complicated:
When running Node.js with
--perf-basic-prof, like this test does (viaNODE_OPTIONS, but that’s not relevalent), it will try to create a file named/tmp/perf-${pid}.map.node/deps/v8/src/log.cc
Lines 283 to 299 in 5c2ee4e
If the file already exists and is not writable, the
CHECKin L299 crashes, causing these failures. If the file does not exist, it is created, and never cleaned up.The host to which I have SSH access has a PID range from 0 to 100000, and currently has 52453 files of that format in
/tmp/, of which 50016 are owned byroot; meaning, it will fail about 50 % of the time, because tests running under theiojsuser doesn’t have permissions to overwrite these files.(I’m deleting all of these files now on that host, just so that the test passes a bit more often. You can re-create the issue locally like this: https://github.com/proxy/gist.github.com/addaleax/e7d6db099ae194a3f56e473c9d4c49a6.)
So:
rootand sometimes asiojs, leading to permissions problems./cc @nodejs/build @nodejs/testing @nodejs/v8
rvagg commentedon Apr 3, 2019
The only circumstances in which tests are run as root in our infra is if they are run manually. We run everything as 'iojs' and it never has sudo access. So I'm suspecting this is a problem with our manual access processes, maybe we need to make it clear that anyone given manual access needs to run tests as 'iojs' and the root SSH access is mainly for convenience. Or maybe we need to give only 'iojs' SSH access most of the time instead?
Trott commentedon Apr 19, 2019
I think this can be closed because the running-tests-as-root thing isn't something that happens in regular CI runs, but is operator error? Or is that letting ourselves off the hook too easily?
Trott commentedon Apr 19, 2019
ncu-ci walk commitonly finds one recent example of this error: https://ci.nodejs.org/job/node-test-commit-freebsd/nodes=freebsd11-x64/25647/testReport/(root)/test/parallel_test_cli_node_options/That was on test-digitalocean-freebsd11-x64-1. For some reason, I am unable to log on to that host to check for root-owned profiling files in
/tmp.test: remove flaky designation for test-cli-node-options
test: remove flaky designation for test-cli-node-options