-
Notifications
You must be signed in to change notification settings - Fork 715
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
Update node version 14.15.5 -> 15.14.0 #829
Conversation
83bb083
to
37c0b84
Compare
I think I don't understand the motivation here yet. The problem with If that is right, then it seems risky to make this change. We should test the node that most users will be running. I think the LTS version is the best guess at that (as it is what the node.js site offers as the default download). However, if we think the |
My understanding is that Folks using emscripten + nodejs in wild will most likely be using the emscripten-built module with other surrounding JS code and they will want to promise rejections in whatever way they see fit and probably don't want emscripten messing with this globally across their entire program. If I'm wrong, we can just leave |
Is the benefit worth the cost? I think running the most common node is safer for us, to match our users. How do you see the benefit of this change, maybe that's what I don't get? (does it allow us to remove any code?) |
This is an example of a place where emscripten is messing with global, process-wide, state in way that it really doesn't need to. Doing this kind of thing is really something that belongs in the overall node application, not just in the emscripten module.
I have not proved this but I think the nodes internal rejection handler will give better error messages that show more clearly the source of the issue rather then going via abort. Personally I often disable both |
Regardless of what we do with |
What do you mean by "we can remove My argument above is that we can't remove it for our users. We can remove just for our own test suite, but our users would still need it (since we don't control the node they use in their test suites - assuming it is the default node download is the most reasonable guess we can make), so we couldn't remove it from our codebase here (only disable it for our own uses). |
I think we might be able to remove it by default and have folks opt into it. I think its only useful to a certain subset of users who meed two conditions: a. targeting older versions of node Users who are embedding an emscripten module inside a wider application probably don't want this global handler to be controlled by the emscripten module. I would argue that (b) is not how real world users use emscripten under node... even though that is how most our test suite works. |
I think we can land this upgrade either way since it offers us more flexibility going forward. |
My concern is that it isn't an older version - it's the current default download that node.js gives people. That's probably most of our users, I think! And the risk is that if they do not know to flip the flag on, then their test suites will silently hide errors. That kind of thing is quite dangerous I think.
This is a fair point that I had not considered before. Yes, perhaps most people's test suites are more modular. But, I am not sure - how can we tell?
It does give us flexibility, but it means we are not testing the default node download any more. But testing the most likely version our users use is the best thing, isn't it? We'd need a strong reason to do otherwise I think, and I don't see that. |
I wasn't really thinking about test suites in particular. I was thinking about folks using emscripten module in production node environments.
Yes and no. Our node testing is really a proxy for browser testing, isn't it? Aren't we assuming that deployments will be massively skewed towards the browser deployments? If we accept that premise then most of our unit tests should really run under and environment that matches the current version of v8 that is running in most user's browsers. Doing most of our testing on an old version of v8 (such as the one in node's LTS) could be seen as a bad thing. I'm not saying this argument wins (because we do have some production node users for sure), but there are certainly two conflicting things that our node unit tests are trying to do here. Perhaps we should have a |
I think it's still a fairly common use case that people build unit tests and run them in node in addition to whatever browser testing they do, for all the same reasons that we do it. |
I think if users are running unit tests for code that will ultimately run in the browser in production they will probably have the same requirements we do, and will most likely use the version of node that ships with emsdk (will will be happy to use that versions if its better/easier). I think the risk here is that folks who are running code under node in production. One easy way to mitigate all the risk here I think would be to set
|
Good point, yes, the last comments really clarify the issues here for me, starting from here. We can maybe just ask on the mailing list to get feedback from people testing with node. My guess, however, differs from yours @sbc100 - when setting up testing on say ammo.js and other libraries, the easiest thing is to use the existing node.js on the system, not the emsdk's. That may even be older than the default node.js download from their website - but I don't think we need to be more careful than the website. An error in debug builds that checks for the node version may help here. But if many users end up needing to flip flags to get things to work in their current node, that's a big downside I think. Another approach might be to investigate in more detail the errors that we worry about being silenced by older node versions. If it's just errors during compiling the wasm, maybe we can add a special check there, for example. Yet another possibility is to use sync node startup by default, assuming that avoids the silencing issue (which I suspect but am not sure of). That has other downsides in terms of testing, but might be worth considering. |
This, along with #18465 (which run tests on the oldest supported version of node) should pave the way for us to update the emsdk version node to something a little more modern. See emscripten-core/emsdk#829 This first thing I do with this setting is use it do disable `NODEJS_CATCH_REJECTION` by default when we are targeting node 15 and above.
This, along with #18465 (which run tests on the oldest supported version of node) should pave the way for us to update the emsdk version node to something a little more modern. See emscripten-core/emsdk#829 This first thing I do with this setting is use it do disable `NODEJS_CATCH_REJECTION` by default when we are targeting node 15 and above.
This, along with #18465 (which run tests on the oldest supported version of node) should pave the way for us to update the emsdk version node to something a little more modern. See emscripten-core/emsdk#829 This first thing I do with this setting is use it do disable `NODEJS_CATCH_REJECTION` by default when we are targeting node 15 and above.
For the record this is why we can't current update to node TLS: nodejs/node#43246 Our bots run ubuntu bionic which is not supported by node 18 and above :( |
This, along with #18465 (which run tests on the oldest supported version of node) should pave the way for us to update the emsdk version node to something a little more modern. See emscripten-core/emsdk#829 This first thing I do with this setting is use it do disable `NODEJS_CATCH_REJECTION` by default when we are targeting node 15 and above.
This, along with #18465 (which run tests on the oldest supported version of node) should pave the way for us to update the emsdk version node to something a little more modern. See emscripten-core/emsdk#829 This first thing I do with this setting is use it do disable `NODEJS_CATCH_REJECTION` by default when we are targeting node 15 and above.
This, along with #18465 (which run tests on the oldest supported version of node) should pave the way for us to update the emsdk version node to something a little more modern. See emscripten-core/emsdk#829 This first thing I do with this setting is use it do disable `NODEJS_CATCH_REJECTION` by default when we are targeting node 15 and above.
With the latest emsdk using node It seems the command that fails is I also tested the command |
Interesting. I think we should try to figure out exactly what is going on here. Could you perhaps attach the failing JS file (along with any dependencies such as the wasm binary)? As a workaround could you perhaps use the system version node to execute your test? With luck it could be a version of node the doesn't have this problem. What OS and version is your test running on? |
Please find attached the JS file and
Do you mean to execute it locally on my system? On my system, I have node (base) ci_fix_build_to_wasm$ node -v
v18.13.0
(base) ci_fix_build_to_wasm$ node test_lfortran.js
[doctest] doctest version is "2.4.8"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 49 | 49 passed | 0 failed | 0 skipped
[doctest] assertions: 456 | 456 passed | 0 failed |
[doctest] Status: SUCCESS!
(base) ci_fix_build_to_wasm$ echo $?
0
(base) ci_fix_build_to_wasm$
The bug seems to occur only at the GitHub CI. For example, https://github.com/Shaikh-Ubaid/lfortran/actions/runs/4667899568/jobs/8264264545 uses node
The test is running on ubuntu-22.04. |
So you are unable to reproduce this locally? No matter what version of node you use? |
So the lines that start with the green |
Yes. Locally, I tested with node
Yes, they are coming from the
It seems to me the red Error line is being printed by GitHub CI runner. For example, on searching on google, I found https://github.com/credativ/vali/actions/runs/4467520060/jobs/7847403788 which prints the same error. |
@Shaikh-Ubaid Can you test with the new node version that this installs, |
Please find executions using different node versions. (the second one from top is node (lf) lfortran$ node -v
v14.18.2
(lf) lfortran$ which node
/home/ubaid/ext/emsdk/node/14.18.2_64bit/bin/node
(lf) lfortran$ node src/lfortran/tests/test_lfortran.js
[doctest] doctest version is "2.4.8"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 49 | 49 passed | 0 failed | 0 skipped
[doctest] assertions: 456 | 456 passed | 0 failed |
[doctest] Status: SUCCESS!
(lf) lfortran$ echo $?
0
(lf) lfortran$
(base) lfortran$ node -v
v15.14.0
(base) lfortran$ which node
/home/ubaid/.nvm/versions/node/v15.14.0/bin/node
(base) lfortran$ node src/lfortran/tests/test_lfortran.js
[doctest] doctest version is "2.4.8"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 49 | 49 passed | 0 failed | 0 skipped
[doctest] assertions: 456 | 456 passed | 0 failed |
[doctest] Status: SUCCESS!
(base) lfortran$ echo $?
0
(base) lfortran$
(base) lfortran$ node -v
v18.12.1
(base) lfortran$ which node
/home/ubaid/.nvm/versions/node/v18.12.1/bin/node
(base) lfortran$ node src/lfortran/tests/test_lfortran.js
[doctest] doctest version is "2.4.8"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 49 | 49 passed | 0 failed | 0 skipped
[doctest] assertions: 456 | 456 passed | 0 failed |
[doctest] Status: SUCCESS!
(base) lfortran$ echo $?
0
(base) lfortran$
(base) lfortran$ node -v
v18.13.0
(base) lfortran$ which node
/home/ubaid/.nvm/versions/node/v18.13.0/bin/node
(base) lfortran$ node src/lfortran/tests/test_lfortran.js
[doctest] doctest version is "2.4.8"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 49 | 49 passed | 0 failed | 0 skipped
[doctest] assertions: 456 | 456 passed | 0 failed |
[doctest] Status: SUCCESS!
(base) lfortran$ echo $?
0
(base) lfortran$
(base) lfortran$ node -v
v18.15.0
(base) lfortran$ which node
/home/ubaid/.nvm/versions/node/v18.15.0/bin/node
(base) lfortran$ node src/lfortran/tests/test_lfortran.js
[doctest] doctest version is "2.4.8"
[doctest] run with "--help" for options
===============================================================================
[doctest] test cases: 49 | 49 passed | 0 failed | 0 skipped
[doctest] assertions: 456 | 456 passed | 0 failed |
[doctest] Status: SUCCESS!
(base) lfortran$ echo $?
0
(base) lfortran$ They all seem to work fine on my system locally. |
Well thats rather annoying isn't it.. I guess one way to move forward would be to add some more debugging information to see where the version on github might be crashing. Can you try building with I also wonder if there are any node verbosity flags you could turn on? How about |
Added debugging flags https://github.com/Shaikh-Ubaid/lfortran/actions/runs/4685550543/jobs/8302754966?pr=14. It seems to exit fine (with exit code |
From googling it looks like this message occurs when the github action times out, but I don't see any other evendence of this. It seems to happen always right after the node run. Can you trying this: Create a |
From the detailed log:
Seems odd that the running would received a shutdown signal add the same place each time. Maybe worth filing a issue with github actions? |
Sure, added script in CI: Create a debug_run.sh script. Still the same https://github.com/Shaikh-Ubaid/lfortran/actions/runs/4692825473/jobs/8319029416?pr=14. |
Sure seems like some kind of bug in github actions. The action claims to be cancelled, which is something that normally happens when it times out, or some other external event occurs. IIUC that should never happen due to something that is running inside the action itself. Maybe open an issue with github? |
There some interesting timing information in the logs:
Note the 37 seconds between the last emscripten message and the |
Please see CI: Use node-12.22.12-64bit and https://github.com/Shaikh-Ubaid/lfortran/actions/runs/4696630413/jobs/8326896817?pr=14. It seems to work with node I observed that on my local system, my From https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources, it looks like the ram capacity available to I guess that it works with node |
So it seems like memory issue and the various node versions seem to have different memory usage characteristics. If this program expected to use a lot of memory? Are you using a large webassembly memory? Are you using a grow-able memory? |
I built the project without emscripten, that is using
We did not pass any Our code uses |
How are you measuring memory? V8 (in node) uses memory in a very different way than a natively-compiled C/C++ version of your app. In particular V8 uses several security isolation techniques that involve reserving large amounts of address space without actually using/committing it. You want to be comparing the working/resident/committed size (the wording varies depending on the OS). It also depends on how large you set the initial linear memory size for wasm. But running in node will probably always cost more memory overall than a native version. |
Certainly seems like like an OOM error yes. Although I can't see why would happen after the node process seems to be done. Is node somehow allocating more memory on exit? Does you code use threads? The actually memory used by emscripten without any extra flags should be 16Mb .. since by default that is the size of wasm memory and it is not growable. If you test code requires multiple Gb of heap I'm not sure how it could ever have run with emscripten defaults. |
I open |
This is about 2 years old, and the node website already provides newer versions both for latest and for LTS. However, other places are behind, for example the latest Ubuntu LTS (22) has Node 12, so perhaps we should wait on this. This is possible after emscripten-core/emsdk#829 made the emsdk install a 15.x version by default.
) This version of node supports wasm-bigint by default, so it will help #19156 Node 16 is over 2 years old, and the node website already provides newer versions both for latest and for LTS. This is possible after emscripten-core/emsdk#829 made the emsdk install a 15.x version by default, and then emscripten-core/emsdk#1232 switched to 16.x.
This is the current v15 release and updating to v15 or above will allow
is to disable and possibly completely remove the
NODEJS_CATCH_REJECTION
setting in emscripten. This setting is aworkaround for the fact the older node versions will return exit with 0
on unhandled promise rejection.
The downside to updating the version used by emsdk and therefore the
version against which we do all our emscripten testing is that we
potentially loose some coverage of compatability with older versions.
In practice I don't think we have seen a node compat issue in many
years. The limits on the JS output produced by emscripten are all
related to targeting older browsers which tend to be a lot older than
any of the node versions we want to target.