Skip to content

V8JS php instable after a "die" or PHP error during a callback #282

@sourisdudesert

Description

@sourisdudesert

At first, thanks for your work on phpv8.

I successfully manage to use V8JS with PHP/Apache for my project, but I discover than V8JS engine seems to become instable when a "die" happens.

It seems non reproductible according to #122 , but I reproduce this 100% of the time.

Symptom :
V8JS works perfectly fine until the first "die" happens. Starting from this, all uses of V8JS by other following requests crashes randomly with no explanation/exception. The only possible way to get back to a stable situation is to restart Apache.

Tested on 2 different systems :
Linux Mint 17.2 / Ubuntu 16.04
Apache 2.4.7 / 2.4.18
V8JS 5.7 (on both system)
phpv8 1.3.3 (on both system, with all options / defaults)

Crash test code used :
crash.php.txt

What this crash test file is doing :
_ during the 5 first steps, the V8JS javascript script makes a callback to a PHP function that "die()".
_ during all the steps afterwards, the V8JS javascript makes a simple callback to a PHP function that returns a normal results.

What happens :
_ The behavior when PHP die is correct (the whole script die).
_ The behavior during the steps afterwards is not correct, as the V8JS crashes and the "Normal end" message do not appear ~50% of the time. The V8JS seems to be frozen.

How to recover from this :
restart Apache.

Conclusion & questions :
I know that using "die" is a bad practice, but this bug gives the feeling that something bad may happens to V8JS that crashes all requests afterwards. This prevents me to go with V8JS in production, because I cannot risk to crash the whole server if something is going wrong with a single request.

  1. shouldn't phpv8 be totally "stateless", so that 1 request crash do not impact any other request?
  2. is it safe to use phpv8 in a production environment at now?

Thanks again for your work & answer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions