Comments (6)
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.
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.
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.
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.
@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.
Won't fix, see discusssion above + extensions now marked deprecated (with pull #330)
from v8js.
Related Issues (20)
- Trying to compile with php8 branch on ubuntu 22, getting error: could not determine libv8 version (v8 compiled succesfully) HOT 3
- Dynamic Properties deprecation in PHP 8.2 HOT 4
- Broken build on PHP 8.0.x HOT 2
- Segmentation fault - possibly another GC issue? HOT 7
- Compromise between FORCE_ARRAY and standard setup HOT 8
- sandbox error with v8 11.1.277.13 HOT 1
- libv8 must be version 9.0 or greater (using dockerfile) HOT 1
- Issue running make in ubuntu 22.04 HOT 2
- windows php 8.1
- compile error with g++ 13: error: expected unqualified-id before '&' token
- With wich version of V8 this php library work ? HOT 4
- Error installing on debian 11
- This LIB is very hard to install ! HOT 14
- PROHIBITS_OVERWRITING removed from V8 and causing V8Js compile error. HOT 1
- V8Js 3.0.0 HOT 1
- Is the latest recommended release 2.1.1 or 2.1.2? HOT 4
- Do I have permission to refactor this? HOT 3
- Compilation error: "no matching function for call to 'v8::ObjectTemplate::SetAccessor" HOT 6
- Linux arm64 support? HOT 3
- Is there an official installation tutorial for the v8js extension? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v8js.