GithubHelp home page GithubHelp logo

Feature suggestion: compile scripts about v8js HOT 15 CLOSED

phpv8 avatar phpv8 commented on August 30, 2024
Feature suggestion: compile scripts

from v8js.

Comments (15)

yllierop avatar yllierop commented on August 30, 2024

@rosmo — Yeah that might just make a bit more sense. I wonder what others think?

from v8js.

stesie avatar stesie commented on August 30, 2024

👍

... but I think we should leave executeString around. The recently added checkString method might be a good candidate for deprecation, in favour of compileString.

from v8js.

rosmo avatar rosmo commented on August 30, 2024

Sounds good. I already wrote preliminary version of the changes needed, but I'll polish them a bit. I chose the resource way, since it's much less work.

from v8js.

rosmo avatar rosmo commented on August 30, 2024

Here's the changes: https://github.com/rosmo/v8js/commits/compile-script

from v8js.

stesie avatar stesie commented on August 30, 2024

Hi @rosmo,

please see my inline comments to your commits.

Besides that

  • I would prefer an implementation of executeString subsequently calling compileString and executeScript (+ free resource) to not duplicate so much code (both execute functions share about 120 lines of unmodified code)
  • what about declaring checkString deprecated and using compileString already internally + freeing the resource immediately? (and if we don't deprecate the symbol, I still think that one can call the other + free resource to not duplicate the code)

cheers
~stesie

from v8js.

rosmo avatar rosmo commented on August 30, 2024

Totally forgot about checkString(). And you're right about the duplication. I'll fix the issues ASAP.

from v8js.

rosmo avatar rosmo commented on August 30, 2024

Here's a better branch: https://github.com/rosmo/v8js/commits/compile-script-fix

I'm not sure about the last commit though, because I'm not that familiar with V8. I thought the previous style was leaking memory, but it seems like the leaking is happening with the master branch as well (Apache's RSS seems to grow and not stabilize).

from v8js.

rosmo avatar rosmo commented on August 30, 2024

The memory leak could be issue #71 related though.

from v8js.

rosmo avatar rosmo commented on August 30, 2024

I updated the compile branch: https://github.com/rosmo/v8js/commits/compile-script-201409

from v8js.

stesie avatar stesie commented on August 30, 2024

@rosmo thanks for your contribution!

I just changed checkString (though deprecated) to use your new functions likewise.

cheers
~stesie

from v8js.

stesie avatar stesie commented on August 30, 2024

hmm, seems like this breaks the test fatal_error_recursive.php at least with certain v8 versions

3.29.1 regularly crashes with this trace

#0  0x00007ffff382c8de in v8::internal::IncrementalMarkingRootMarkingVisitor::VisitPointer(v8::internal::Object**) ()
   from /var/lib/jenkins/workspace/v8js-with-v8-3.29.1/v8-3.29.1/lib/libv8.so
#1  0x00007ffff38ea5cd in v8::internal::Isolate::Iterate(v8::internal::ObjectVisitor*, v8::internal::ThreadLocalTop*) ()
   from /var/lib/jenkins/workspace/v8js-with-v8-3.29.1/v8-3.29.1/lib/libv8.so
#2  0x00007ffff3810873 in v8::internal::Heap::IterateStrongRoots(v8::internal::ObjectVisitor*, v8::internal::VisitMode) ()
   from /var/lib/jenkins/workspace/v8js-with-v8-3.29.1/v8-3.29.1/lib/libv8.so
#3  0x00007ffff382d6ed in v8::internal::IncrementalMarking::StartMarking(v8::internal::IncrementalMarking::CompactionFlag) ()
   from /var/lib/jenkins/workspace/v8js-with-v8-3.29.1/v8-3.29.1/lib/libv8.so
#4  0x00007ffff382e2a3 in v8::internal::IncrementalMarking::Start(v8::internal::IncrementalMarking::CompactionFlag) ()
   from /var/lib/jenkins/workspace/v8js-with-v8-3.29.1/v8-3.29.1/lib/libv8.so
#5  0x00007ffff381f55e in v8::internal::Heap::IdleNotification(int) ()
   from /var/lib/jenkins/workspace/v8js-with-v8-3.29.1/v8-3.29.1/lib/libv8.so
#6  0x00007ffff3f46c2e in php_v8js_free_storage (object=0x7ffff7fd56a8) at /home/stesie/Projekte/v8js/v8js.cc:694
#7  0x00000000006c6d17 in zend_objects_store_free_object_storage ()
#8  0x00000000006912dc in ?? ()
#9  0x000000000069fd85 in ?? ()
#10 0x000000000063f47a in php_request_shutdown ()
#11 0x0000000000749fe4 in ?? ()
#12 0x000000000043141a in ?? ()
#13 0x00007ffff4d62b45 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#14 0x00000000004314ad in _start ()

from v8js.

stesie avatar stesie commented on August 30, 2024

hmmm, I'll close this again, since it doesn't seem to be the cause of the problem.

The problem probably is still only the stack unwinding stuff, the commit above makes it better but it's still not stable. Jenkins tells v8 versions 3.29.54 to 3.29.66 are unstable (i.e. the aforementioned test fails) and all other versions from 3.27.1 on are stable. However I cannot verify that on a second box.

And I just now noticed that subsequent requests (within the same php process) to one with a unwound fatal error just fail. I'll follow up with a specific bug report.

from v8js.

rosmo avatar rosmo commented on August 30, 2024

Could we blacklist some versions if they are unstable?

from v8js.

stesie avatar stesie commented on August 30, 2024

@rosmo I don't think that blacklisting is the way to go. The unwinding still has its flaws (two less since today, but still at least one more) and leads to crashes here and there. I can reproduce crashes with versions 3.29.54 to 3.29.66 on two boxes with PHP 5.4; but not with 5.5 (which crashes with 3.25.30 though).

from v8js.

rosmo avatar rosmo commented on August 30, 2024

@stesie There is a difference/bug when doing previous executeString and executeScript (we noticed this while doing an upgrade). I will try to produce a test case for this.

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.