Re: Concept: Lightweight error channels
| From: | Edmond Dantes | Date: | Sun, 27 Apr 2025 17:12:35 +0000 |
| Subject: | Re: Concept: Lightweight error channels | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127201@lists.php.net to get a copy of this message | ||
The HHVM project suggests an interesting Lazy backtrace generation
mechanism based on stack unwinding.
1.
An exception is generated.
2.
The stack enters an unwinding mode. In this mode, PHP gradually collects
information into the backtrace.
3.
Each frame exit contributes a part of the backtrace.
4.
Once the exception is caught, the unwinding process stops.
5.
Now a decision can be made: either generate the full backtrace or
suppress the exception.
Advantages:
1.
Allows deferring backtrace generation until the exception is caught.
2.
Allows suppressing exceptions without a backtrace, making their creation
cost cheap.
3.
Allows preserving exceptions with a backtrace only when necessary.
Disadvantages: requires added complexity.