Our project recently upgraded from v8 version 7.6 to 8.3. While running the unit tests a couple of our tests fail with the following message only on Windows and UBSan builds. The linux and MacOS tend to work fine.
22:43:24 Running mapreduce builtin tests
22:43:24 /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/unique_ptr.h:78:2: runtime error: member call on address 0x60d000000040 which does not point to an object of type 'v8::Platform'
22:43:24 0x60d000000040: note: object has invalid vptr
22:43:24 01 00 00 0e e0 4f b4 9a 9e 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
22:43:24 ^~~~~~~~~~~~~~~~~~~~~~~
22:43:24 invalid vptr
22:43:24 #0 0x4f1c88 in std::default_delete<v8::Platform>::operator()(v8::Platform*) const /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/unique_ptr.h:78:2
22:43:24 #1 0x4ebbab in std::unique_ptr<v8::Platform, std::default_delete<v8::Platform> >::~unique_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/unique_ptr.h:263:4
22:43:24 #2 0x7f9e9591c160 in __run_exit_handlers /build/glibc-S7xCS9/glibc-2.27/stdlib/exit.c:108
22:43:24 #3 0x7f9e9591c259 in exit /build/glibc-S7xCS9/glibc-2.27/stdlib/exit.c:139
22:43:24 #4 0x7f9e958fabfd in __libc_start_main /build/glibc-S7xCS9/glibc-2.27/csu/../csu/libc-start.c:344
22:43:24 #5 0x439489 in _start (/home/couchbase/jenkins/workspace/couchstore.ASan-UBSan_master/build/couchstore/couchstore_mapreduce-builtin-test+0x439489)
22:43:24
22:43:24 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/unique_ptr.h:78:2 in
I'm not really sure how to make sense of it. Seems like it has something to do with the platform.
void initV8(const char* executable_img)
{
V8::InitializeICUDefaultLocation(executable_img, nullptr);
v8platform = platform::NewDefaultPlatform();
V8::InitializePlatform(v8platform.get());
V8::Initialize();
}
void deinitV8()
{
V8::Dispose();
V8::ShutdownPlatform();
}
This is how the code looks like!
Thanks