On Thu, Jul 18, 2019 at 3:10 PM Christopher Nelson <nadiasver...@gmail.com> wrote:
> I appreciate that info, and I have read it. However, that is very unlikely > to be the problem here. In this case I am not passing any C++ ABI objects > between libraries, I'm just creating a new isolate. The reproduction is so > minimal and so simple that is seems very unlikely that libc++ is at fault > here. It happens deep inside the isolate initialization. > I see. It sounds like you have a full repro to share; could you perhaps open a bug at crbug.com/v8/new, include the repro, and I will try to have a look next week. > > On Thursday, July 18, 2019 at 8:43:42 AM UTC-4, Jakob Gruber wrote: >> >> On Thu, Jul 18, 2019 at 2:32 PM Christopher Nelson <nadias...@gmail.com> >> wrote: >> >>> I'm not using the same exact libc++, no. I don't have a problem doing >>> that, but I'd like to link v8 against MY libc++ instead of linking my app >>> against v8's libc++. The reason is: I am compiling against a number of >>> libraries, all of which are compiled against my libc++. Trying to change >>> them all to compile against V8's libc++ is probably not possible. >>> >>> I'm also a little suspicious that libc++ is the problem here because it >>> works fine in release; which I would expect to be _more_ sensitive. In any >>> case, if you can tell me how or point me to instructions on how to tell V8 >>> which libc++ to use I will very happily implement that. >>> >> >> I assume building with a libcxx that is neither the system libcxx nor >> V8's custom libcxx will need manual work. I'm not an expert on this either, >> I've just seen folks run into this fairly frequently in recent times. >> >> Here's where all of my infos come from: https://crbug.com/v8/9150#c2. >> Maybe this will help clarify. >> >> >>> >>> On Thursday, July 18, 2019 at 1:22:04 AM UTC-4, Jakob Gruber wrote: >>>> >>>> On Wed, Jul 17, 2019 at 5:48 PM Christopher Nelson <nadias...@gmail.com> >>>> wrote: >>>> >>>>> Thank you so much for the help that has been provided so far. Sadly, I >>>>> tried both of these suggestions without success. >>>>> >>>>> First, I removed all of the build arguments except: >>>>> >>>>> is_debug = true >>>>> target_cpu = "x64" >>>>> v8_monolithic = true >>>>> v8_enable_i18n_support = false >>>>> >>>>> I built this with much the same results. I also duplicated this >>>>> problem on macOS with debug. (Release works fine on both platforms.) >>>>> >>>>> I also tried setting "use_custom_libcxx = false", but we use libc++ >>>>> (the one shipped with clang) on Linux and macOS. I couldn't find a way to >>>>> tell v8 to set -stdlib libc++ without it also wanting that to be the >>>>> custom >>>>> one v8 compiles. If I set this value to false then the flag is omitted and >>>>> it picks up libstdc++ by default, which results in a lot of link errors. >>>>> >>>> >>>> Just to confirm: are you linking your project against the same custom >>>> libcxx that V8 uses? If yes, then we need to start looking elsewhere (than >>>> use_custom_libcxx) for the problem. If no, that would still be my >>>> suspicion. >>>> >>>> Note also how the backtrace below is in a completely different spot in >>>> V8 than the one you posted before. And this time in deallocate (before it >>>> was in an allocation). >>>> >>>> >>>>> >>>>> My colleague and I have managed to duplicate this in the most trivial >>>>> hello-world program, which just initializes the engine and creates an >>>>> isolate. >>>>> >>>>> The interesting thing is that the d8 app created by the v8 build is >>>>> fine. It is only applications that link against the v8 monolith outside >>>>> the >>>>> v8 build that experience the problem. We also accidentally noted that if >>>>> we >>>>> initialize the engine twice, the problem goes away. >>>>> >>>> >>>>> As I say, this wasn't a problem in 7.2, but in 7.3+ it's happening >>>>> with perfect reproducibility. For the record, here is the backtrace: >>>>> >>>>> #0 __GI_raise (sig=sig@entry=6) at >>>>> ../sysdeps/unix/sysv/linux/raise.c:50 >>>>> #1 0x00007ffff7b5a535 in __GI_abort () at abort.c:79 >>>>> #2 0x00007ffff7bc1726 in __libc_message (action=action@entry=do_abort, >>>>> fmt=fmt@entry=0x7ffff7ce7952 "%s\n") at >>>>> ../sysdeps/posix/libc_fatal.c:181 >>>>> #3 0x00007ffff7bc859a in malloc_printerr (str=str@entry=0x7ffff7ce5a9b >>>>> "free(): invalid pointer") at malloc.c:5352 >>>>> #4 0x00007ffff7bca3cc in _int_free (av=<optimized out>, p=<optimized >>>>> out>, have_lock=<optimized out>) at malloc.c:4181 >>>>> #5 0x0000000004da70e5 in __do_call () at >>>>> ../../buildtools/third_party/libc++/trunk/include/new:319 >>>>> #6 __do_deallocate_handle_size () at >>>>> ../../buildtools/third_party/libc++/trunk/include/new:277 >>>>> #7 __do_deallocate_handle_size_align () at >>>>> ../../buildtools/third_party/libc++/trunk/include/new:247 >>>>> #8 __libcpp_deallocate () at >>>>> ../../buildtools/third_party/libc++/trunk/include/new:325 >>>>> #9 deallocate () at >>>>> ../../buildtools/third_party/libc++/trunk/include/memory:1816 >>>>> #10 deallocate () at >>>>> ../../buildtools/third_party/libc++/trunk/include/memory:1554 >>>>> #11 ~basic_string () at >>>>> ../../buildtools/third_party/libc++/trunk/include/string:2138 >>>>> #12 Print () at ../../src/code-stub-assembler.cc:13702 >>>>> #13 0x00000000051e254d in LoadKeyValuePairNoSideEffects () at >>>>> gen/torque-generated/builtins-collections-from-dsl-gen.cc:533 >>>>> #14 0x0000000004cfc7e1 in AddConstructorEntry () at >>>>> ../../src/builtins/builtins-collections-gen.cc:163 >>>>> #15 0x0000000004d10fb6 in operator() () at >>>>> ../../src/builtins/builtins-collections-gen.cc:270 >>>>> #16 __invoke<(lambda at >>>>> ../../src/builtins/builtins-collections-gen.cc:267:22) &, >>>>> v8::internal::compiler::Node *> () at >>>>> ../../buildtools/third_party/libc++/trunk/include/type_traits:4399 >>>>> #17 __call<(lambda at >>>>> ../../src/builtins/builtins-collections-gen.cc:267:22) &, >>>>> v8::internal::compiler::Node *> () at >>>>> ../../buildtools/third_party/libc++/trunk/include/__functional_base:348 >>>>> #18 operator() () at >>>>> ../../buildtools/third_party/libc++/trunk/include/functional:1531 >>>>> #19 __call_impl<std::__1::__function::__alloc_func<(lambda at >>>>> ../../src/builtins/builtins-collections-gen.cc:267:22), >>>>> std::__1::allocator<(lambda at >>>>> ../../src/builtins/builtins-collections-gen.cc:267:22)>, void >>>>> (v8::internal::compiler::Node *)> > () at >>>>> ../../buildtools/third_party/libc++/trunk/include/functional:2014 >>>>> #20 0x0000000004d76fb1 in operator() () at >>>>> ../../buildtools/third_party/libc++/trunk/include/functional:2127 >>>>> #21 operator() () at >>>>> ../../buildtools/third_party/libc++/trunk/include/functional:2351 >>>>> #22 BuildFastLoop () at ../../src/code-stub-assembler.cc:10997 >>>>> #23 0x0000000004cfd8e0 in BuildFastLoop () at >>>>> ../../src/code-stub-assembler.h:3062 >>>>> #24 AddConstructorEntriesFromFastJSArray () at >>>>> ../../src/builtins/builtins-collections-gen.cc:278 >>>>> #25 0x0000000004cfcd55 in AddConstructorEntries () at >>>>> ../../src/builtins/builtins-collections-gen.cc:207 >>>>> #26 0x0000000004cfeebf in GenerateConstructor () at >>>>> ../../src/builtins/builtins-collections-gen.cc:416 >>>>> #27 0x0000000004cff596 in GenerateMapConstructorImpl () at >>>>> ../../src/builtins/builtins-collections-gen.cc:740 >>>>> #28 0x0000000004cff3ea in Generate_MapConstructor () at >>>>> ../../src/builtins/builtins-collections-gen.cc:734 >>>>> #29 0x0000000004c6b147 in BuildWithCodeStubAssemblerJS () at >>>>> ../../src/builtins/setup-builtins-internal.cc:179 >>>>> #30 SetupBuiltinsInternal () at >>>>> ../../src/builtins/setup-builtins-internal.cc:353 >>>>> #31 0x0000000004c62687 in SetupBuiltins () at >>>>> ../../src/setup-isolate-full.cc:18 >>>>> #32 0x0000000004395524 in Init () at ../../src/isolate.cc:3394 >>>>> #33 0x0000000004394c4d in v8::internal::Isolate::InitWithoutSnapshot() >>>>> () at ../../src/isolate.cc:3284 >>>>> #34 0x0000000003f50007 in Initialize () at ../../src/api.cc:8211 >>>>> #35 0x0000000003f5055f in New () at ../../src/api.cc:8223 >>>>> #36 0x0000000003eb369c in hiram::js::isolate::isolate >>>>> (this=0x7fffffffcf88) at ../../../../../engine/src/js/isolate.cpp:20 >>>>> #37 0x0000000003dae967 in ____C_A_T_C_H____T_E_S_T____6 () at >>>>> ../../../../../engine/test/test_element_node.cpp:62 >>>>> #38 0x0000000003d01b33 in Catch::TestInvokerAsFunction::invoke >>>>> (this=0x7677650) at >>>>> ../../../../../.mm/linux/amd64/debug/include/catch2/catch.hpp:11841 >>>>> #39 0x0000000003cfc6d6 in Catch::TestCase::invoke (this=0x76dfe60) at >>>>> ../../../../../.mm/linux/amd64/debug/include/catch2/catch.hpp:11742 >>>>> #40 0x0000000003cfc60a in Catch::RunContext::invokeActiveTestCase >>>>> (this=0x7fffffffd818) at >>>>> ../../../../../.mm/linux/amd64/debug/include/catch2/catch.hpp:10601 >>>>> #41 0x0000000003cfb164 in Catch::RunContext::runCurrentTest >>>>> (this=0x7fffffffd818, redirectedCout=..., redirectedCerr=...) at >>>>> ../../../../../.mm/linux/amd64/debug/include/catch2/catch.hpp:10574 >>>>> #42 0x0000000003cfa4fc in Catch::RunContext::runTest >>>>> (this=0x7fffffffd818, testCase=...) at >>>>> ../../../../../.mm/linux/amd64/debug/include/catch2/catch.hpp:10344 >>>>> #43 0x0000000003cfe9fd in Catch::(anonymous namespace)::runTests >>>>> (config=...) at >>>>> ../../../../../.mm/linux/amd64/debug/include/catch2/catch.hpp:10903 >>>>> #44 0x0000000003cfe4b2 in Catch::Session::runInternal >>>>> (this=0x7fffffffdb90) at >>>>> ../../../../../.mm/linux/amd64/debug/include/catch2/catch.hpp:11098 >>>>> #45 0x0000000003cfe22b in Catch::Session::run (this=0x7fffffffdb90) at >>>>> ../../../../../.mm/linux/amd64/debug/include/catch2/catch.hpp:11055 >>>>> #46 0x0000000003d2d54a in Catch::Session::run<char> >>>>> (this=0x7fffffffdb90, argc=1, argv=0x7fffffffdde8) at >>>>> ../../../../../.mm/linux/amd64/debug/include/catch2/catch.hpp:10801 >>>>> #47 0x0000000003d0fc24 in main (argc=1, argv=0x7fffffffdde8) at >>>>> ../../../../../engine/test/main.cpp:25 >>>>> >>>>> This is the content of the main.cpp: >>>>> >>>>> std::unique_ptr<v8::Platform> platform = >>>>> v8::platform::NewDefaultPlatform(); >>>>> v8::V8::InitializePlatform(platform.get()); >>>>> v8::V8::Initialize(); >>>>> >>>>> int result = Catch::Session().run(argc, argv); >>>>> >>>>> v8::V8::Dispose(); >>>>> v8::V8::ShutdownPlatform(); >>>>> >>>>> And the code that is failing: >>>>> >>>>> create_params.array_buffer_allocator = >>>>> v8::ArrayBuffer::Allocator::NewDefaultAllocator(); >>>>> i = v8::Isolate::New(create_params); >>>>> >>>>> I'm trying more variations, but if there's something else I can do to >>>>> help anyone help me, I will happily do so. >>>>> >>>>> Thanks again! >>>>> >>>>> -- >>>>> -- >>>>> v8-users mailing list >>>>> v8-u...@googlegroups.com >>>>> http://groups.google.com/group/v8-users >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "v8-users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to v8-u...@googlegroups.com. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/v8-users/f81d746d-0ced-4841-8736-ed5d8ef90bc0%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/v8-users/f81d746d-0ced-4841-8736-ed5d8ef90bc0%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >>> -- >>> v8-users mailing list >>> v8-u...@googlegroups.com >>> http://groups.google.com/group/v8-users >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "v8-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to v8-u...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/v8-users/945801a6-ddce-42c2-9dc4-44334cb794f5%40googlegroups.com >>> <https://groups.google.com/d/msgid/v8-users/945801a6-ddce-42c2-9dc4-44334cb794f5%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to v8-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/v8-users/30e33f59-8f7d-4022-9d31-c3d5eb025fba%40googlegroups.com > <https://groups.google.com/d/msgid/v8-users/30e33f59-8f7d-4022-9d31-c3d5eb025fba%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/CAH3p7oOh1g3HUwtP%3D1rMCc57VxfvRxT6eSqhYL%3DMF3-HAcXw4w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.