V8 crashing in Embeded application during creating v8 isolated object.

262 views
Skip to first unread message

Saad Al Abdullah

unread,
Jun 23, 2022, 8:41:37 PM6/23/22
to v8-users
Hello,
I have aspnet core application  and I create V8 isolate object for each request and dispose end of the request. Sometimes I am seeing  FatalProcessOutOfMemory  exceptions even though I have enough available physical memory (RAM).  Is there any heap limitation for V8 ? 


     v8.dll!v8::base::OS::Abort() Line 1114    C++    Symbols loaded.
     v8.dll!v8::Utils::ReportOOMFailure(v8::internal::Isolate * isolate=0x00000011b07f29f0, const char * location, bool is_heap_oom) Line 340    C++    Symbols loaded.
     v8.dll!v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate * isolate=0x00000203860d4270, const char * location=0x00000011b07f2500, bool is_heap_oom) Line 306    C++    Symbols loaded.
     v8.dll!v8::internal::Heap::FatalProcessOutOfMemory(const char * location=0x0000020280d7fac0) Line 6363    C++    Symbols loaded.
     [Inline Frame] v8.dll!v8::internal::MemoryAllocator::HandleAllocationFailure() Line 294    C++    Symbols loaded.
     v8.dll!v8::internal::MemoryAllocator::AllocateAlignedMemory(unsigned __int64 chunk_size=262144, unsigned __int64 area_size=241664, unsigned __int64 alignment=262144, v8::internal::Executability executable=EXECUTABLE, void * hint=0x0000000000000000, v8::internal::VirtualMemory * controller=0x00000011b07fbff0) Line 249    C++    Symbols loaded.
     v8.dll!v8::internal::MemoryAllocator::AllocateUninitializedChunk(v8::internal::BaseSpace * space=0x0000020282b99730, unsigned __int64 area_size=241664, v8::internal::Executability executable=EXECUTABLE, v8::internal::PageSize page_size=kRegular) Line 357    C++    Symbols loaded.
     v8.dll!v8::internal::MemoryAllocator::AllocatePage(v8::internal::MemoryAllocator::AllocationMode alloc_mode, v8::internal::Space * space=0x0000020282b99730, v8::internal::Executability executable=EXECUTABLE) Line 546    C++    Symbols loaded.
     v8.dll!v8::internal::PagedSpace::Expand() Line 346    C++    Symbols loaded.
     [Inline Frame] v8.dll!v8::internal::PagedSpace::TryExpand(int) Line 924    C++    Symbols loaded.
     v8.dll!v8::internal::PagedSpace::RawRefillLabMain(int size_in_bytes, v8::internal::AllocationOrigin origin=kRuntime) Line 974    C++    Symbols loaded.
     v8.dll!v8::internal::PagedSpace::RefillLabMain(int size_in_bytes, v8::internal::AllocationOrigin origin) Line 909    C++    Symbols loaded.
     v8.dll!v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int size=-30, v8::internal::AllocationType allocation=kCode, v8::internal::AllocationOrigin origin=kRuntime, v8::internal::AllocationAlignment alignment=kTaggedAligned) Line 82    C++    Symbols loaded.
     v8.dll!v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int size=128, v8::internal::AllocationType allocation=' ', v8::internal::AllocationOrigin origin=kRuntime, v8::internal::AllocationAlignment alignment=kTaggedAligned) Line 108    C++    Symbols loaded.
     v8.dll!v8::internal::Heap::AllocateRawOrFail(int size=-2133860350, v8::internal::AllocationType allocation=kCode, v8::internal::AllocationOrigin origin=-1879576767, v8::internal::AllocationAlignment alignment=kTaggedAligned) Line 209    C++    Symbols loaded.
     [Inline Frame] v8.dll!v8::internal::Deserializer<v8::internal::Isolate>::Allocate(v8::internal::AllocationType) Line 1317    C++    Symbols loaded.
     v8.dll!v8::internal::Deserializer<v8::internal::Isolate>::ReadObject(v8::internal::SnapshotSpace space) Line 671    C++    Symbols loaded.
     v8.dll!v8::internal::Deserializer<v8::internal::Isolate>::ReadSingleBytecodeData<v8::internal::SlotAccessorForHeapObject>(unsigned char data, v8::internal::SlotAccessorForHeapObject slot_accessor={...}) Line 939    C++    Symbols loaded.
     v8.dll!v8::internal::Deserializer<v8::internal::Isolate>::ReadData(v8::internal::Handle<v8::internal::HeapObject> object={...}, int start_slot_index, int end_slot_index=8) Line 908    C++    Symbols loaded.
     v8.dll!v8::internal::Deserializer<v8::internal::Isolate>::ReadObject(v8::internal::SnapshotSpace space) Line 710    C++    Symbols loaded.
     v8.dll!v8::internal::Deserializer<v8::internal::Isolate>::ReadSingleBytecodeData<v8::internal::SlotAccessorForRootSlots>(unsigned char data, v8::internal::SlotAccessorForRootSlots slot_accessor={...}) Line 939    C++    Symbols loaded.
     [Inline Frame] v8.dll!v8::internal::Deserializer<v8::internal::Isolate>::ReadData(v8::internal::FullMaybeObjectSlot) Line 920    C++    Symbols loaded.
     v8.dll!v8::internal::Deserializer<v8::internal::Isolate>::VisitRootPointers(v8::internal::Root root=-1333801424, const char * description=0x0000000000000001, v8::internal::FullObjectSlot start, v8::internal::FullObjectSlot end={...}) Line 293    C++    Symbols loaded.
     v8.dll!v8::internal::RootVisitor::VisitRootPointer(v8::internal::Root root, const char * description, v8::internal::FullObjectSlot p) Line 77    C++    Symbols loaded.
     [Inline Frame] v8.dll!v8::internal::Heap::IterateBuiltins(v8::internal::RootVisitor *) Line 5135    C++    Symbols loaded.
     v8.dll!v8::internal::Heap::IterateRoots(v8::internal::RootVisitor * v=0x00000011b07fce30, v8::base::EnumSet<enum v8::internal::SkipRoot,int> options={...}) Line 4994    C++    Symbols loaded.
>    v8.dll!v8::internal::StartupDeserializer::DeserializeIntoIsolate() Line 34    C++    Symbols loaded.
     v8.dll!v8::internal::Isolate::Init(v8::internal::SnapshotData * startup_snapshot_data=0x00000011b07fd2b0, v8::internal::SnapshotData * read_only_snapshot_data=0x00000011b07fd298, v8::internal::SnapshotData * shared_heap_snapshot_data=0x00000011b07fd280, bool can_rehash=false) Line 4106    C++    Symbols loaded.
     v8.dll!v8::internal::Snapshot::Initialize(v8::internal::Isolate * isolate=0x00000203860d4270) Line 187    C++    Symbols loaded.
     v8.dll!v8::Isolate::Initialize(v8::Isolate * isolate=0x00000203860d4270, const v8::Isolate::CreateParams & params={...}) Line 8642    C++    Symbols loaded.
     v8.dll!v8::Isolate::New(const v8::Isolate::CreateParams & params={...}) Line 8680    C++    Symbols loaded.
     [Inline Frame] v8.dll!V8RuntimeImp::{ctor}(unsigned __int64) Line 65    C++    Symbols loaded.
     v8.dll!CreateV8RunTime(int max_old_space_in_MB, int max_semi_space_in_MB, void * * runtimeHandler=0x00000011b07fd678) Line 41    C++    Symbols loaded.

Jakob Kummerow

unread,
Jun 24, 2022, 9:58:08 AM6/24/22
to v8-users
AllocateRawOrFail(int size=-2133860350, ...) looks bad. Apparently that request is coming out of the snapshot...


--
--
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-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/3feedcc9-50f9-4a90-97b6-7fc54045c84en%40googlegroups.com.

Saad Al Abdullah

unread,
Jun 24, 2022, 1:06:51 PM6/24/22
to v8-u...@googlegroups.com
Hello Jakob,

The only possible way to size (int size=-2133860350, ...)was negative if there is int overflow. I am not using any external snapshot blob during V8 isolate object creation which means V8 is using  DefaultSnapshotBlob data. I thought every time I create V8 isolate object, it'll initialize from DefaultSnapshotBlob data and size is 1047264. Would you give me some inside knowledge how snapshot is used during isolate object creation if there is no external snapshot provided? Do you think should I use an external snapshot object to initialize isolate object?  

 Thank you
Siam

Jakob Kummerow

unread,
Jun 27, 2022, 4:29:01 AM6/27/22
to v8-users
Using the default snapshot should be fine, and it should definitely not be >2GiB in size. Something is weird there. I'd suggest investigating in more depth (with a Debug build) where that negative size is coming from.


Reply all
Reply to author
Forward
0 new messages