Skip to content
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

tests: fix test failure due to os.freemem() behaviour change in node v18 #2530

Merged
merged 1 commit into from
Jan 15, 2022

Conversation

trentm
Copy link
Member

@trentm trentm commented Jan 14, 2022

Recent node v18 nightly builds changed the behaviour of os.freemem()
on Linux to report "MemAvailable" from /proc/meminfo rather than
"MemFree". This broke our tests.

The nightly "edge" tests started failing ~6-7 days ago with:

running test: cd . && node --unhandled-rejections=strict test/metrics/index.test.js > test_output/test-metrics-index.test.js.tap 2&>1
...
[2022-01-14T19:31:11.076Z] node_tests_1     | # system.memory.actual.free
[2022-01-14T19:31:11.076Z] node_tests_1     | ok 11 is present
[2022-01-14T19:31:11.076Z] node_tests_1     | ok 12 is a number
[2022-01-14T19:31:11.076Z] node_tests_1     | ok 13 is finite (was: 10925056000)
[2022-01-14T19:31:11.076Z] node_tests_1     | not ok 14 is larger than os.freemem() (value: 10925056000, free: 10925056000)
[2022-01-14T19:31:11.076Z] node_tests_1     |   ---
[2022-01-14T19:31:11.076Z] node_tests_1     |     operator: ok
[2022-01-14T19:31:11.076Z] node_tests_1     |     expected: true
[2022-01-14T19:31:11.076Z] node_tests_1     |     actual:   false
[2022-01-14T19:31:11.076Z] node_tests_1     |     at: Object.system.memory.actual.free (/app/test/metrics/index.test.js:79:13)
[2022-01-14T19:31:11.076Z] node_tests_1     |     stack: |-
[2022-01-14T19:31:11.076Z] node_tests_1     |       Error: is larger than os.freemem() (value: 10925056000, free: 10925056000)
[2022-01-14T19:31:11.077Z] node_tests_1     |           at Test.assert [as _assert] (/app/node_modules/tape/lib/test.js:311:54)
[2022-01-14T19:31:11.077Z] node_tests_1     |           at Test.bound [as _assert] (/app/node_modules/tape/lib/test.js:96:32)
[2022-01-14T19:31:11.077Z] node_tests_1     |           at Test.assert (/app/node_modules/tape/lib/test.js:430:10)
[2022-01-14T19:31:11.077Z] node_tests_1     |           at Test.bound [as ok] (/app/node_modules/tape/lib/test.js:96:32)
[2022-01-14T19:31:11.077Z] node_tests_1     |           at Object.system.memory.actual.free (/app/test/metrics/index.test.js:79:13)
[2022-01-14T19:31:11.077Z] node_tests_1     |           at Object.sendMetricSet (/app/test/metrics/index.test.js:137:20)
[2022-01-14T19:31:11.077Z] node_tests_1     |           at /app/lib/metrics/reporter.js:4:1202
[2022-01-14T19:31:11.077Z] node_tests_1     |           at /app/node_modules/after-all-results/index.js:20:25
[2022-01-14T19:31:11.077Z] node_tests_1     |           at processTicksAndRejections (node:internal/process/task_queues:78:11)
[2022-01-14T19:31:11.077Z] node_tests_1     |   ...

The breakage started in node nightly build "v18.0.0-nightly20220107b6b6510187".
The culprit node change was nodejs/node#41398, which upgrades libuv, which brought in a change to os.freemem() on Linux: libuv/libuv#3351

This broke an assumption in our tests.

Recent node v18 nightly builds changed the behaviour of os.freemem()
on Linux to report "MemAvailable" from /proc/meminfo rather than
"MemFree". This broke our tests.
@trentm trentm self-assigned this Jan 14, 2022
@trentm trentm requested a review from astorm January 14, 2022 22:06
@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Jan 14, 2022
@apmmachine
Copy link
Contributor

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-01-14T22:06:47.927+0000

  • Duration: 21 min 8 sec

  • Commit: 98e243d

Test stats 🧪

Test Results
Failed 0
Passed 242323
Skipped 0
Total 242323

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run module tests for <modules> : Run TAV tests for one or more modules, where <modules> can be either a comma separated list of modules (e.g. memcached,redis) or the string literal ALL to test all modules

  • run benchmark tests : Run the benchmark test only.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@trentm trentm merged commit 6acaaa0 into master Jan 15, 2022
@trentm trentm deleted the trentm/fix-test-for-os-freemem-change branch January 15, 2022 01:07
trentm added a commit that referenced this pull request Jan 20, 2022
…v17.4.0

The update to libuv 1.43.0 changed the behaviour of os.freemem() on
Linux to report "MemAvailable" from /proc/meminfo rather than "MemFree".

Refs: #2530
trentm added a commit that referenced this pull request Jan 20, 2022
…v17.4.0 (#2540)

The update to libuv 1.43.0 changed the behaviour of os.freemem() on
Linux to report "MemAvailable" from /proc/meminfo rather than "MemFree".

Refs: #2530
astorm pushed a commit that referenced this pull request Feb 4, 2022
…v18 (#2530)

Recent node v18 nightly builds changed the behaviour of os.freemem()
on Linux to report "MemAvailable" from /proc/meminfo rather than
"MemFree". This broke our tests.
astorm pushed a commit that referenced this pull request Feb 4, 2022
…v17.4.0 (#2540)

The update to libuv 1.43.0 changed the behaviour of os.freemem() on
Linux to report "MemAvailable" from /proc/meminfo rather than "MemFree".

Refs: #2530
trentm added a commit that referenced this pull request Feb 10, 2022
…v16.14.0

The update to libuv 1.43.0 changed the behaviour of os.freemem() on
Linux to report "MemAvailable" from /proc/meminfo rather than "MemFree".

Refs: #2530, #2540
trentm added a commit that referenced this pull request Feb 10, 2022
…v16.14.0 (#2570)

The update to libuv 1.43.0 changed the behaviour of os.freemem() on
Linux to report "MemAvailable" from /proc/meminfo rather than "MemFree".

Refs: #2530, #2540
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants