GithubHelp home page GithubHelp logo

unregistering extensions about v8js HOT 6 CLOSED

rbro avatar rbro commented on August 30, 2024
unregistering extensions

from v8js.

Comments (6)

stesie avatar stesie commented on August 30, 2024

No, extensions can neither be removed nor can they be added once V8 is fully initialized -- this is a limitation of V8, not of V8Js.

What are you trying to do? It shouldn't be needed to restart the Apache server completely, after all restarting the PHP process should be sufficient (i.e. next http request) as those don't share a V8 instance.

from v8js.

rbro avatar rbro commented on August 30, 2024

Thanks for your help. I am running both apache/mod_php and nginx/php-fpm. In both web servers, extensions registered with registerExtension seem to persist from request to request.

For example, using apache/mod_php, if I run the following script:

executeString('test()', 'test_call'); ?>

I see test1 printed as expected.

I then edited the script to change the test1 to test2 as in:

executeString('test()', 'test_call'); ?>

If I run the script repeatedly, I sometimes get test1 and other times get test2. I believe it's related to the number of child processes apache is running and which one serves my request, but I haven't confirmed.

Also, if I change my script to be:

executeString('test()', 'test_call'); ?>

I also get a mix of test1 and test2 output even though the extension wasn't registered explicitly in my script. The extension appears to be persisting outside of the request.

Is this intended? That was the reason I was asking about the unregister functionality as right now, I have to restart apache to update my script.

Please let me know if I can supply more information. Thanks again for your help.

from v8js.

stesie avatar stesie commented on August 30, 2024

hey

I had another look at the issue. My previous statement was not quiet correct, since a single php process indeed serves multiple requests at least with the mentioned SAPIs. And since v8 is only started once per process (i.e. not per request) loaded extensions are shared between multiple requests.

Unfortunately v8 cannot be shutdown and restarted within a single process, neither can an extension be unloaded. Hence I would consider this behavior unwanted but unfixable also (with mod_php and fpm)

You might want to use the cgi version of php, which has performance implications on the other hand, but serves only one request per process and hence should not show that behavior.

cheers
stesie

from v8js.

cscott avatar cscott commented on August 30, 2024

It might be worth reworking the extensions API in v8js more accurately as a 'persistent connection' sort of thing -- and possibly raising an error if you open a V8Js object without the registered extensions, due to the way the v8 API works. Currently there is some odd behavior with respect to the lifetime of the 'extensions' global compared to the lifetime of the v8 instance -- if you're running under ZTS you can have a thread which does not share the extensions global but which does inherit the extensions configuration from the other threads.

from v8js.

yllierop avatar yllierop commented on August 30, 2024

@cscott — This seems like a very reasonable approach to me and I'm all for it. I'd like to fix as much as the odd behavior as possible. Once again @stesie and @cscott I really appreciate all that you've done thus far.

from v8js.

stesie avatar stesie commented on August 30, 2024

Won't fix, see discusssion above + extensions now marked deprecated (with pull #330)

from v8js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.