Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

[Feature Request] Get termination info of thread on fatal error #923

Open
ghost opened this issue Feb 3, 2019 · 0 comments
Open

[Feature Request] Get termination info of thread on fatal error #923

ghost opened this issue Feb 3, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Feb 3, 2019

Environment

  • PHP: PHP 7.2.14 (cli) (built: Jan 9 2019 22:23:26) ( ZTS MSVC15 (Visual C++ 2017) x64 )
  • pthreads: 3.2.0
  • OS: Windows 7 Pro x64

Summary

I would like to be able to get the termination info of a thread. I know Threaded::getTerminationInfo() was removed in v3 because you can wrap the Threaded::run method into a try-catch block, but my issue is deeper.

I'm using a Thread as worker to handle tasks asynchronously. However when a fatal error occurs, this can not be caught, and even if it were recoverable fatal error I can't. Since the thread continues to run after invoking the run method and leaves any try-catch blocks, the started thread may crash at any time, without affecting the main thread. The fatal error message will be written to the console.

An example I'm currently debugging:

PHP Fatal error:  Method Exception::__toString() must not throw an exception, caught ErrorException: Expected array for frame 0 in ... on line 0
PHP Stack trace:
PHP   1. ...

I'd like to be able to get the termination information (in essence the fatal error informatio in the case above), including the level, to be able to log and handle the error correctly. This would also allow me to integrate it into Sentry.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants