-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
src: temporary fix for AIX malloc issue #7229
Conversation
note once the compiler fix has been delivered and gcc updated on the build machines I will revert this change |
LGTM provided CI is green. |
uv_buf_t* buf = reinterpret_cast<uv_buf_t*>(malloc(sizeof(uv_buf_t))); | ||
uv_write_t* req = reinterpret_cast<uv_write_t*>(malloc(sizeof(uv_write_t))); | ||
uv_buf_t* buf = reinterpret_cast<uv_buf_t*>(NODE_MALLOC(sizeof(uv_buf_t))); | ||
uv_write_t* req = reinterpret_cast<uv_write_t*>(NODE_MALLOC(sizeof(uv_write_t))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is > 80 chars, not too sure what a clean way to break it would be. Any suggestions?
Same with line 478.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other places in the codebase there’s a line break (+ double indent) after the =
in these situations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated accordingly!
CI is all green minus the linting issues which I have already fixed up |
LGTM |
Ok , will plan to land this tomorrow unless there objections before then. |
Uhm. What exactly does call See also #6305. |
This is the specific example: bash-4.3$ cat test.js That we know of in this case. There could be others which are possible through the APIs but which are not caught by the existing tests. We could fix this specific case if that make sense. |
@iwuzhere could you put together the patch for fixing just the cases were w know the malloc(0) was being hit so that we can see how intrusive it is (or not) |
With the introduction of the v8 inspector the following tests started to fail on AIX: test-async-wrap-post-did-throw test-async-wrap-throw-from-callback test-crypto-random The reason for the failures was a `malloc(0)` issue. On GNU compatible `malloc` a `malloc(0)` returns a vaild pointer, but on AIX it returns a null pointer which is considered to be a failure in node. In order to get a GNU compatible `malloc` AIX requires the following flags to be defined: `_LINUX_SOURCE_COMPAT` `_ALL_SOURCE` However regardless of these flags, the STL headers undefine `malloc` and replace it with a non GNU compatible `malloc`. This is a temporary workaround until the AIX team for gcc release an update that fixes this behaviour.
a simple non-intrusive fix would be the following: diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 383a18a..1a40dd1 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -5490,6 +5490,11 @@ void RandomBytes(const FunctionCallbackInfo<Value>& args) {
return env->ThrowRangeError("size is not a valid Smi");
Local<Object> obj = env->NewInternalFieldObject();
+
+ if (size == 0) {
+ size++;
+ }
+
RandomBytesRequest* req = new RandomBytesRequest(env, obj, size);
if (args[1]->IsFunction()) { Again this raises the question if |
Wrong question. If it works now, then it shouldn't be broken because of some platform-specific quirk. |
Well it seems like this solution is not going to be accepted (it is somewhat hack-y). The real issue is with gcc on AIX. There /should/ be an update soon fixing the issue. |
Possibly failing again, see #7549 |
Checklist
make -j4 test
(UNIX) orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
src
Description of change
With the introduction of the v8 inspector the following tests started to
fail on AIX:
test-async-wrap-post-did-throw
test-async-wrap-throw-from-callback
test-crypto-random
The reason for the failures was a
malloc(0)
issue. On GNU compatiblemalloc
amalloc(0)
returns a vaild pointer, but on AIX it returnsa null pointer which is considered to be a failure in node.
In order to get a GNU compatible
malloc
AIX requires the followingflags to be defined:
_LINUX_SOURCE_COMPAT
_ALL_SOURCE
However regardless of these flags, the STL headers undefine
malloc
and replace it with a non GNU compatible
malloc
. This is a temporaryworkaround until the AIX team for gcc release an update that fixes this
behaviour.
For more information (and also fixes): #7080
AIX CI run: https://ci.nodejs.org/job/node-test-commit-aix/210/