From e94190044c95959b8067a1ea81bd202efbd188f3 Mon Sep 17 00:00:00 2001 From: gabylb Date: Mon, 18 Nov 2019 13:28:06 -0500 Subject: [PATCH 1/8] include zos when setting javahome --- binding.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index a6ef43d6..8744f919 100644 --- a/binding.gyp +++ b/binding.gyp @@ -15,7 +15,7 @@ ['OS=="win"', { 'javahome%': ' Date: Wed, 20 Nov 2019 23:01:08 -0500 Subject: [PATCH 2/8] remove O2 and O3 opts due to compile issue causing intermittent failure --- binding.gyp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index 8744f919..dd13697b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -19,7 +19,7 @@ 'javahome%': ' Date: Mon, 18 Nov 2019 13:28:06 -0500 Subject: [PATCH 3/8] include zos when setting javahome --- binding.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index a6ef43d6..8744f919 100644 --- a/binding.gyp +++ b/binding.gyp @@ -15,7 +15,7 @@ ['OS=="win"', { 'javahome%': ' Date: Wed, 20 Nov 2019 23:01:08 -0500 Subject: [PATCH 4/8] remove O2 and O3 opts due to compile issue causing intermittent failure --- binding.gyp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index 8744f919..dd13697b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -19,7 +19,7 @@ 'javahome%': ' Date: Fri, 26 Jun 2020 08:24:26 -0400 Subject: [PATCH 5/8] replace GetContents() by GetBackingStore() Ref: https://github.com/nodejs/node/pull/30339 --- src/utils.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils.cpp b/src/utils.cpp index 6c899555..1c8aceca 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -484,7 +484,11 @@ jvalueType javaGetArrayComponentType(JNIEnv *env, jobjectArray array) { #if (NODE_VERSION_AT_LEAST(4, 0, 0)) v8::Local newArrayBuffer(void* elems, size_t length) { v8::Local ab = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), length); +#if (V8_MAJOR_VERSION >= 8) + memcpy(ab->GetBackingStore()->Data(), elems, length); +#else memcpy(ab->GetContents().Data(), elems, length); +#endif return ab; } #endif From 6c172799e47546a26de3f9155849e30307282693 Mon Sep 17 00:00:00 2001 From: baghdadi Date: Fri, 26 Jun 2020 17:57:12 -0400 Subject: [PATCH 6/8] zos: set compiler flags based on compiler and node versions This is to workaround previous (to v14) versions of node and a compiler bug affected by those versions, as follows: - v8 (ships with D190508), requires -U_VARARG_EXT_ and no-opt - v12 (ships with D191122), requires no-opt - v14 (ships with D191122), no workaround needed. --- binding.gyp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/binding.gyp b/binding.gyp index dd13697b..702f8e33 100644 --- a/binding.gyp +++ b/binding.gyp @@ -24,6 +24,9 @@ ['OS=="linux" or OS=="mac" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { 'javalibdir%': " Date: Thu, 9 Jul 2020 13:05:53 -0400 Subject: [PATCH 7/8] link to libjvm.x on z/OS Find Java's lib_dir to link to libjvm.x, instead of assuming users have their LDFLAGS env variable set to that path. --- binding.gyp | 7 +++++-- find_java_libdir.sh | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/binding.gyp b/binding.gyp index 702f8e33..143cf0b1 100644 --- a/binding.gyp +++ b/binding.gyp @@ -21,11 +21,11 @@ ['OS=="mac"', { 'javaver%' : " Date: Wed, 30 Sep 2020 13:30:49 -0400 Subject: [PATCH 8/8] src: verify pointer before calling its method The destructor InstanceMethodCallBaton() calls m_javaObject->Unref() which aborts when m_javaObject is NULL. Affects at least `npm test` from `node-jdbc` npm, which aborts in test `testcreatetable`: (abort) [0x26C7C640] (__cxa_end_catch) [0x2E2CC414] (InstanceMethodCallBaton::~InstanceMethodCallBaton()+0x140) [0x2E2CD2A4] (Nan::AsyncWorker::Destroy()@AF61_58+0x28) [0x2E2CCE4C] (Nan::AsyncWorker::Destroy()+0x18) [0x2E2C9F12] (Nan::AsyncExecuteComplete(uv_work_s*)+0x4e) [0x27DB5430] ... --- src/methodCallBaton.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/methodCallBaton.cpp b/src/methodCallBaton.cpp index 61e16189..08119949 100644 --- a/src/methodCallBaton.cpp +++ b/src/methodCallBaton.cpp @@ -236,5 +236,8 @@ InstanceMethodCallBaton::InstanceMethodCallBaton( } InstanceMethodCallBaton::~InstanceMethodCallBaton() { - m_javaObject->Unref(); + if (m_javaObject) { + m_javaObject->Unref(); + m_javaObject = NULL; + } }