Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6979699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:55:09+00:00 2026-05-27T17:55:09+00:00

I work with v8 (google’s javascript engine) recently. When the GC is running, String::New

  • 0

I work with v8 (google’s javascript engine) recently. When the GC is running, String::New always trigger a assert at ASSERT(state_ != NEAR_DEATH)(global-handles.cc 237line). Does have some suggestion.

Here is some of my source snippet:

void javascript_ctx_impl::call_obj_func (v8::persistent<object> object, const char* method, int argc, handle<value> argv[]) 
{ 
    handlescope handle_scope; 
    local<value> cb = object->get(string::new(method)); 
    if (!cb->isfunction()) { 
        std::cerr << "method = " << method << std::endl; 
                return; 
    } 
    local<function> do_action = local<function>::cast(cb); 
    trycatch try_catch; 
    /**ASSERT HERE **/
    **do_action->call(object, argc, argv);** 
    /**ASSERT HERE **/
    if (try_catch.hascaught()) { 
                v8::local<v8::message> msg = try_catch.message (); 
        if (!msg->getscriptresourcename().isempty() && !msg- 
>getscriptresourcename()->isundefined()) 

        { 
            v8::string::asciivalue name (msg- 
>getscriptresourcename()); 

            std::cerr << *name << std::endl; 
        } 
        else { 
            std::cerr << "call_obj_func: runtime error." << std::endl; 
        } 
    } 
} 

template <typename T> 
class write_handle : public handle_impl_base 
{ 
    public: 
       write_handle (boost::asio::io_service& io, v8::Persistent<Object> 
local,v8::Persistent<Object> h) 
       : handle_impl_base (io), handle_ (h), session_ (local) 
       { 
       } 
    public: 
        void operator () (const boost::system::error_code& ec, 
std::size_t bytes_transferred) 
        { 
            HandleScope handle_scope; 
            if (!ec) { 
                Handle<Value> args[3] = { 
                    js::instance ().safe_new_value (session_), 
                                        js::instance ().safe_new_value ("TRUE"), 
                                        js::instance ().safe_new_value (bytes_transferred) 
                }; 
                                js::instance ().call_obj_func (handle_, "onHandle", 3, args); 
            } 
            else { 
                Handle<Value> args[3] = { 
                    js::instance ().safe_new_value (session_), 
                                        js::instance ().safe_new_value ("FALSE"), 
                                        js::instance ().safe_new_value (bytes_transferred) 
                }; 
                                js::instance ().call_obj_func (handle_, "onHandle", 3, args); 
            } 
            handle_.Dispose (); session_.Dispose (); 
        } 
        static void handle_weak (Persistent<Value> object, void* 
parameter) 
        { 
            object.Dispose ();
        } 
    private: 
        v8::Persistent<Object> handle_; 
        v8::Persistent<Object> session_; 
}; 

v8::Handle<v8::Value> js_asio_socket_ip_tcp_function::async_write (const v8::Arguments& args) 
{ 
    HandleScope hScope; 
    js_asio_socket_ip_tcp_function* native_obj = 
unwrap<js_asio_socket_ip_tcp_function>(args.This()); 
    if (args.Length () < 4) { 
        return ThrowException (Exception::TypeError(String::New( 
                        "async_resolve need 4 parameters.")) 
                ); 
    } 
    /** Argument check here */ 
    js_stream_function* s = unwrap<js_stream_function> (args[1]- 
>ToObject ()); 

    if (s == NULL) { 
        return ThrowException (Exception::TypeError(String::New( 
                        "async_resolve parameter 2 error.")) 
                ); 
    } 
    v8::Local<v8::Object>  p0 = args[0]->ToObject (); 
    v8::Local<v8::Integer> p2 = args[2]->ToUint32 (); 
    v8::Persistent<Object> handle; 
    v8::Persistent<Object> sessin; 
    if (args[3]->ToObject ()->IsFunction ()) { 
        v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(args[3]->ToObject()); 
        handle = v8::Persistent<v8::Object>::New(f); 
    } 
    else { 
        handle = v8::Persistent<Object>::New (args[3]->ToObject ()); 
    } 
    handle.MakeWeak (NULL, write_handle<void>::handle_weak); 
    handle.MarkIndependent (); 
    sessin = v8::Persistent<Object>::New (p0); 
    boost::asio::async_write (*(native_obj->socket_), 
            boost::asio::buffer (s->get (), p2->Value ()), 
            boost::asio::transfer_all (), 
            make_concrete_handle (write_handle <void> (native_obj- 
>socket_->get_io_service (), sessin, handle) 

                ) 
            ); 
    return v8::Undefined (); 
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:55:10+00:00Added an answer on May 27, 2026 at 5:55 pm

    Your write_handle<T>::handle_weak is empty. It should never be empty as this violates its contract documented at https://github.com/v8/v8/blob/master/include/v8.h#L124-132

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any guidelines to writing Google App Engine Python code that would work
Has anybody tried to setup sbt to work with Google App Engine? I dream
I'm trying to get the django-cms to work on google-app-engine. Did anyone succeed in
I am intrigued as to how singletons work in Google App Engine (or any
I am running Django (1.0.2) on Google App Engine, and would like to know
Does Django signals work on google app engine ? I am using django-nonrel. Thanks
Is there a way I can make class decorators work on Google App Engine
I am attempting to work with Google Checkout on Google App Engine. Currently, I
I need to write to HKEY_CURRENTUSER using javascript. It should work on Google chrome
Is BlazeDS 4 work with Google App Engine. I'm using BlazeDS 3.2.0 and getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.