Re: [v8-users] Re: Intermittent crashing creating a Persistent object.
I recently had a problem where a Persistent was being initialised in one Isolate which was then disposed. I accidentally kept an initialised Persistent around and got an immediate crash when calling Persistent Reset after creating a 2nd Isolate. In my case I was neglecting to Reset properly one Persistent handle. The weak callback was properly invoked, and on destruction I was also walking the heap for tagged Persistent objects (isolate->VisitHandlesWithClassIds) but the culprit was the lack of one single Persistent Reset. Maybe worth a look. El miércoles, 31 de agosto de 2022 a las 19:56:02 UTC+2, loude...@gmail.com escribió: > A mutex around our persistent creation alone didn't solve this problem. > Removing v8::Persistent and replacing them with v8::Global is not ideal, > since we reuse these Persistent objects across multiple contexts to cache > common function/object templates. > > On Friday, August 26, 2022 at 9:17:00 AM UTC-7 loude...@gmail.com wrote: > >> Oh, single-threaded. I would have expected v8 to use a mutex around >> their persistent (global handle) management. I'll try a mutex on my side >> and see if that resolves the issue. Thanks for your help. 爛 >> >> On Fri, Aug 26, 2022 at 12:52 AM dinf...@chromium.org < >> dinf...@chromium.org> wrote: >> >>> Hi, >>> >>> Those persistent/global handles are single-threaded only, could it be >>> that you allocate such handles from multiple threads? >>> >>> There is also v8::Global which Reset()s itself in the destructor >>> automatically. We would even like to remove v8::Persistent entirely at some >>> point (see >>> https://bugs.chromium.org/p/v8/issues/detail?id=12915=v8%3A%3APersistent=2 >>> ). >>> >>> Cheers, >>> Dominik >>> >>> On Friday, August 26, 2022 at 12:23:12 AM UTC+2 loude...@gmail.com >>> wrote: >>> Yeah, we are out of date and I will attempt to upgrade soon. But, I do think there's a threading issue here that's very intermittent. I did read other posts that describe problems if you don't call Reset on the persistent object. See any problems here? typedef std::pair > PeristentWeakDataPair; typedef v8::WeakCallbackInfo PersistentWeakData; static utils::PersistentP makePersistent(v8::Isolate *isolate, v8::Handle object, DataDeleterP* dataDeleterPP, PersistentWeakData::Callback callback) { utils::PersistentP persistentObjP(new PERSISTENT_BASE(v8::Object)(isolate, object)); persistentObjP->SetWeak(new PeristentWeakDataPair(dataDeleterPP, persistentObjP), callback, v8::WeakCallbackType::kParameter); return persistentObjP; } static void releasePersistent (const PersistentWeakData& data) { PeristentWeakDataPair* paramPairP = data.GetParameter(); delete paramPairP->first; paramPairP->second->Reset(); paramPairP->second.reset(); delete paramPairP; #ifdef ADOBE_V8_DEBUG_V8_ALLOCATIONS DecrementV8AllocCount(); #endif } On Thursday, August 25, 2022 at 6:02:02 AM UTC-7 les...@chromium.org wrote: > This is unfortunately too little detail to go on, my best guess would > be that you're passing in an invalid Isolate pointer (something to do > with > lifetimes in the embedder?). Also note that you're using a 1-year old > version of V8. > > On Wednesday, August 24, 2022 at 10:42:51 PM UTC+2 loude...@gmail.com > wrote: > >> Anyone?? >> >> On Wednesday, June 15, 2022 at 5:25:20 PM UTC-7 loude...@gmail.com >> wrote: >> >>> Any ideas why I'm seeing an intermittent crash here? It happens >>> during a stress test for Adobe Character Animator (v8 >>> version: 9.4.146.24). This call is made 1000s of times in our app and >>> occasionally there's a crash. >>> >>> Character Animator >>> (Beta).exe!v8::internal::GlobalHandles::Create(class >>> v8::internal::Object) >>>Unknown >>> Character Animator >>> (Beta).exe!v8::internal::GlobalHandles::Create(unsigned __int64) >>> Unknown >>> Character Animator (Beta).exe!v8::V8::GlobalizeReference(class >>> v8::internal::Isolate *,unsigned __int64 *)Unknown >>> >[Inline Frame] Character Animator >>> (Beta).exe!v8::PersistentBase::New(v8::Isolate *) Line >>> 10971 >>> C++ >>> [Inline Frame] Character Animator >>> (Beta).exe!v8::Persistent>::{ctor}(v8::Isolate >>> >>> *) Line 682C++ >>> Character Animator >>> (Beta).exe!adobe_v8::makePersistent(v8::Isolate * isolate, >>> v8::Local object, boost::shared_ptr * dataDeleterPP, >>> void(*)(const v8::WeakCallbackInfo >>> *,adobe_v8::utils::PersistentP>> &) callback) Line 1508
Re: [v8-users] Re: Intermittent crashing creating a Persistent object.
A mutex around our persistent creation alone didn't solve this problem. Removing v8::Persistent and replacing them with v8::Global is not ideal, since we reuse these Persistent objects across multiple contexts to cache common function/object templates. On Friday, August 26, 2022 at 9:17:00 AM UTC-7 loude...@gmail.com wrote: > Oh, single-threaded. I would have expected v8 to use a mutex around their > persistent (global handle) management. I'll try a mutex on my side and see > if that resolves the issue. Thanks for your help. 爛 > > On Fri, Aug 26, 2022 at 12:52 AM dinf...@chromium.org < > dinf...@chromium.org> wrote: > >> Hi, >> >> Those persistent/global handles are single-threaded only, could it be >> that you allocate such handles from multiple threads? >> >> There is also v8::Global which Reset()s itself in the destructor >> automatically. We would even like to remove v8::Persistent entirely at some >> point (see >> https://bugs.chromium.org/p/v8/issues/detail?id=12915=v8%3A%3APersistent=2 >> ). >> >> Cheers, >> Dominik >> >> On Friday, August 26, 2022 at 12:23:12 AM UTC+2 loude...@gmail.com wrote: >> >>> Yeah, we are out of date and I will attempt to upgrade soon. But, I do >>> think there's a threading issue here that's very intermittent. I did read >>> other posts that describe problems if you don't call Reset on the >>> persistent object. See any problems here? >>> >>> typedef std::pair > >>> PeristentWeakDataPair; >>> typedef v8::WeakCallbackInfo >>> PersistentWeakData; >>> >>> static >>> utils::PersistentP makePersistent(v8::Isolate *isolate, >>> v8::Handle object, DataDeleterP* dataDeleterPP, >>> PersistentWeakData::Callback callback) { >>> utils::PersistentP persistentObjP(new >>> PERSISTENT_BASE(v8::Object)(isolate, object)); >>> persistentObjP->SetWeak(new PeristentWeakDataPair(dataDeleterPP, >>> persistentObjP), callback, v8::WeakCallbackType::kParameter); >>> return persistentObjP; >>> } >>> >>> static >>> void releasePersistent (const PersistentWeakData& data) >>> { >>> PeristentWeakDataPair* paramPairP = data.GetParameter(); >>> >>> delete paramPairP->first; >>> paramPairP->second->Reset(); >>> paramPairP->second.reset(); >>> delete paramPairP; >>> >>> #ifdef ADOBE_V8_DEBUG_V8_ALLOCATIONS >>> DecrementV8AllocCount(); >>> #endif >>> } >>> >>> On Thursday, August 25, 2022 at 6:02:02 AM UTC-7 les...@chromium.org >>> wrote: >>> This is unfortunately too little detail to go on, my best guess would be that you're passing in an invalid Isolate pointer (something to do with lifetimes in the embedder?). Also note that you're using a 1-year old version of V8. On Wednesday, August 24, 2022 at 10:42:51 PM UTC+2 loude...@gmail.com wrote: > Anyone?? > > On Wednesday, June 15, 2022 at 5:25:20 PM UTC-7 loude...@gmail.com > wrote: > >> Any ideas why I'm seeing an intermittent crash here? It happens >> during a stress test for Adobe Character Animator (v8 >> version: 9.4.146.24). This call is made 1000s of times in our app and >> occasionally there's a crash. >> >> Character Animator >> (Beta).exe!v8::internal::GlobalHandles::Create(class >> v8::internal::Object) >>Unknown >> Character Animator >> (Beta).exe!v8::internal::GlobalHandles::Create(unsigned __int64) >> Unknown >> Character Animator (Beta).exe!v8::V8::GlobalizeReference(class >> v8::internal::Isolate *,unsigned __int64 *)Unknown >> >[Inline Frame] Character Animator >> (Beta).exe!v8::PersistentBase::New(v8::Isolate *) Line 10971 >> >> C++ >> [Inline Frame] Character Animator >> (Beta).exe!v8::Persistent>::{ctor}(v8::Isolate >> >> *) Line 682C++ >> Character Animator >> (Beta).exe!adobe_v8::makePersistent(v8::Isolate * isolate, >> v8::Local object, boost::shared_ptr * dataDeleterPP, >> void(*)(const v8::WeakCallbackInfo >> *,adobe_v8::utils::PersistentP>> &) callback) Line 1508 >> C++ >> Character Animator >> (Beta).exe!adobe_v8::CreatePersistentData(v8::Isolate * inIsolateP, >> v8::Local obj, boost::shared_ptr dataDeleterP) Line >> 1548 >>C++ >> Character Animator >> (Beta).exe!adobe_v8::AttachPersistentDataToInstance(v8::Isolate * >> inIsolateP, v8::Local instance, void * dataP, >> boost::shared_ptr dataDeleterP) Line 1583C++ >> >> The thread 0x8c4 has exited with code 0 (0x0). >> <31172> <5> Number of export render threads: 4 >> Exception thrown at 0x00014105BACA in Character Animator >> (Beta).exe: 0xC005: Access violation reading location >> 0x. >> > -- >> -- >> v8-users mailing list >> v8-u...@googlegroups.com >>
Re: [v8-users] Re: Intermittent crashing creating a Persistent object.
Oh, single-threaded. I would have expected v8 to use a mutex around their persistent (global handle) management. I'll try a mutex on my side and see if that resolves the issue. Thanks for your help. 爛 On Fri, Aug 26, 2022 at 12:52 AM dinf...@chromium.org wrote: > Hi, > > Those persistent/global handles are single-threaded only, could it be that > you allocate such handles from multiple threads? > > There is also v8::Global which Reset()s itself in the destructor > automatically. We would even like to remove v8::Persistent entirely at some > point (see > https://bugs.chromium.org/p/v8/issues/detail?id=12915=v8%3A%3APersistent=2 > ). > > Cheers, > Dominik > > On Friday, August 26, 2022 at 12:23:12 AM UTC+2 loude...@gmail.com wrote: > >> Yeah, we are out of date and I will attempt to upgrade soon. But, I do >> think there's a threading issue here that's very intermittent. I did read >> other posts that describe problems if you don't call Reset on the >> persistent object. See any problems here? >> >> typedef std::pair > >> PeristentWeakDataPair; >> typedef v8::WeakCallbackInfo >> PersistentWeakData; >> >> static >> utils::PersistentP makePersistent(v8::Isolate *isolate, >> v8::Handle object, DataDeleterP* dataDeleterPP, >> PersistentWeakData::Callback callback) { >> utils::PersistentP persistentObjP(new >> PERSISTENT_BASE(v8::Object)(isolate, object)); >> persistentObjP->SetWeak(new PeristentWeakDataPair(dataDeleterPP, >> persistentObjP), callback, v8::WeakCallbackType::kParameter); >> return persistentObjP; >> } >> >> static >> void releasePersistent (const PersistentWeakData& data) >> { >> PeristentWeakDataPair* paramPairP = data.GetParameter(); >> >> delete paramPairP->first; >> paramPairP->second->Reset(); >> paramPairP->second.reset(); >> delete paramPairP; >> >> #ifdef ADOBE_V8_DEBUG_V8_ALLOCATIONS >> DecrementV8AllocCount(); >> #endif >> } >> >> On Thursday, August 25, 2022 at 6:02:02 AM UTC-7 les...@chromium.org >> wrote: >> >>> This is unfortunately too little detail to go on, my best guess would be >>> that you're passing in an invalid Isolate pointer (something to do with >>> lifetimes in the embedder?). Also note that you're using a 1-year old >>> version of V8. >>> >>> On Wednesday, August 24, 2022 at 10:42:51 PM UTC+2 loude...@gmail.com >>> wrote: >>> Anyone?? On Wednesday, June 15, 2022 at 5:25:20 PM UTC-7 loude...@gmail.com wrote: > Any ideas why I'm seeing an intermittent crash here? It happens > during a stress test for Adobe Character Animator (v8 > version: 9.4.146.24). This call is made 1000s of times in our app and > occasionally there's a crash. > > Character Animator > (Beta).exe!v8::internal::GlobalHandles::Create(class v8::internal::Object) >Unknown > Character Animator > (Beta).exe!v8::internal::GlobalHandles::Create(unsigned __int64) > Unknown > Character Animator (Beta).exe!v8::V8::GlobalizeReference(class > v8::internal::Isolate *,unsigned __int64 *)Unknown > >[Inline Frame] Character Animator > (Beta).exe!v8::PersistentBase::New(v8::Isolate *) Line 10971 > C++ > [Inline Frame] Character Animator > (Beta).exe!v8::Persistent>::{ctor}(v8::Isolate > *) Line 682C++ > Character Animator > (Beta).exe!adobe_v8::makePersistent(v8::Isolate * isolate, > v8::Local object, boost::shared_ptr * dataDeleterPP, > void(*)(const v8::WeakCallbackInfo > *,adobe_v8::utils::PersistentP>> &) callback) Line 1508C++ > Character Animator > (Beta).exe!adobe_v8::CreatePersistentData(v8::Isolate * inIsolateP, > v8::Local obj, boost::shared_ptr dataDeleterP) Line 1548 >C++ > Character Animator > (Beta).exe!adobe_v8::AttachPersistentDataToInstance(v8::Isolate * > inIsolateP, v8::Local instance, void * dataP, > boost::shared_ptr dataDeleterP) Line 1583C++ > > The thread 0x8c4 has exited with code 0 (0x0). > <31172> <5> Number of export render threads: 4 > Exception thrown at 0x00014105BACA in Character Animator > (Beta).exe: 0xC005: Access violation reading location > 0x. > -- > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to a topic in the > Google Groups "v8-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/v8-users/Pg5OPm7uPFY/unsubscribe. > To unsubscribe from this group and all its topics, 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/a95e8264-8f5a-4b5c-9e14-410982a61683n%40googlegroups.com >