Fatal error: Interceptor silently changed store target

24 views
Skip to first unread message

Danny Dorfman

unread,
Sep 13, 2016, 3:25:11 AM9/13/16
to v8-users
Hello there,

I just updated my V8 to the latest 5.2 patch level (5.2.361.54), and now I'm getting this error:

#
# Fatal error in v8::NamedPropertySetterCallback
# Interceptor silently changed store target.
#

What exactly does it mean? Please assist.

Regards,
Danny

Danny Dorfman

unread,
Sep 13, 2016, 3:49:37 AM9/13/16
to v8-users
Here is a program that demonstrates this issue: (removing line #28 eliminates the problem)

  1 #include <iostream>
  2 #include <string.h>
  3 #include "v8/libplatform/libplatform.h"
  4 #include "v8/v8.h"
  5 
  6 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
  7  public:
  8   virtual void* Allocate(size_t length) {
  9     void* data = AllocateUninitialized(length);
 10     return data == NULL ? data : memset(data, 0, length);
 11   }
 12   virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
 13   virtual void Free(void* data, size_t) { free(data); }
 14 };
 15 
 16 void GetProperty(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info)
 17 {
 18     v8::String::Utf8Value asciiprop(property);
 19     std::cout << "GETTER: property=" << *asciiprop << std::endl;
 20 }
 21 
 22 void SetProperty(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info)
 23 {
 24     v8::Isolate *isolate = info.GetIsolate();
 25     v8::String::Utf8Value asciiproperty(property);
 26     v8::String::Utf8Value asciivalue(value);
 27     std::cout << "SETTER: property=" << *asciiproperty << ", value=" <<  *asciivalue << std::endl;
 28     std::cout << "SETTER: hash=" << info.This()->GetIdentityHash() << std::endl;
 29 }
 30 
 31 int main(int argc, char* argv[])
 32 {
 33   // Initialize V8.
 34   v8::V8::InitializeICU();
 35   v8::V8::InitializeExternalStartupData(argv[0]);
 36   v8::Platform* platform = v8::platform::CreateDefaultPlatform();
 37   v8::V8::InitializePlatform(platform);
 38   v8::V8::Initialize();
 39 
 40   // Create a new Isolate and make it the current one.
 41   ArrayBufferAllocator allocator;
 42   v8::Isolate::CreateParams create_params;
 43   create_params.array_buffer_allocator = &allocator;
 44   v8::Isolate* isolate = v8::Isolate::New(create_params);
 45   {
 46     v8::Isolate::Scope isolate_scope(isolate);
 47     v8::HandleScope handle_scope(isolate);
 48     v8::Local<v8::ObjectTemplate> objectTemplate = v8::ObjectTemplate::New();
 49     objectTemplate->SetNamedPropertyHandler(GetProperty,SetProperty);
 50     v8::Local<v8::Context> ctx = v8::Context::New(isolate);
 51     v8::Context::Scope context_scope(ctx);
52 
 53     // run tests
 54     v8::Local<v8::String> fooStr = v8::String::NewFromUtf8(isolate, "foo");
 55     v8::Local<v8::String> barStr = v8::String::NewFromUtf8(isolate, "bar");
 56     v8::Local<v8::Object> obj = objectTemplate->NewInstance();
 57     obj->Set(fooStr, barStr);
 58   }
 59 
 60   // Dispose the isolate and tear down V8.
 61   isolate->Dispose();
 62   v8::V8::Dispose();
 63   v8::V8::ShutdownPlatform();
 64   delete platform;
 65   return 0;
 66 }

Ben Noordhuis

unread,
Sep 13, 2016, 6:39:34 AM9/13/16
to v8-users
I think you found a bug.

JSObject::GetOrCreateIdentityHash() computes the hash lazily and
caches it as a symbol property on the object but it looks up that
property with the OWN flag instead of OWN_SKIP_INTERCEPTOR. That
looks incorrect because it means it's going to call your interceptor
again.

There is a debug check that verifies it's a data property but it's
skipped in release builds. I'd file an issue if I were you.

Danny Dorfman

unread,
Sep 13, 2016, 6:56:17 AM9/13/16
to v8-users
Hi Ben,
Thanks for backing up my suspicion. Bug was filed ... https://bugs.chromium.org/p/v8/issues/detail?id=5379
D.
Reply all
Reply to author
Forward
0 new messages