-
-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugging errors #55
Comments
Difficult to say what to do in this specific case, but I'd like to help you debug this further. The starting point would be https://github.com/spatie/async/blob/master/src/Process/ParallelProcess.php#L117 When a child processes encounters an error, it will serialize it and pass it to the parent process. This is where that is handled. I'd start by inspecting the output from If there's no useful information in the output, we'll have to look in the child process itself. Take a look at https://github.com/spatie/async/blob/master/src/Runtime/ChildRuntime.php. The try/catch is what's passing the exception to the parent process. There's two ways of debugging the child process: either run the child process on its own, or write the output from within the child process to a file. The latter is often the more easy one. You could for example write the message of the caught exception to a log file. |
Please let me know when you found what happened, if possible I'd like this package to handle all errors in a debugable way. |
Thanks @brendt . In my code example, where should I look for getErrorOutput()? I see that it's a method in ParallelProcess class, whereas the exception class is ParallelError. . |
Sorry if I didn't make myself clear: it's possible that there's in issue within this package with error handling, and these debug tips should be done in the vendor files. Another option is to fork this repo locally and link it via your composer file. |
I decided to implement this in a CodeIgniter 3 project, and now I am getting some warnings. The full code now:
The logs are is parallelism supported? 1 something happened. Error: PHP Warning: Class 'Paralleltest' not found in /home/sayan/Documents/Programming/testing/vendor/opis/closure/src/SerializableClosure.php on line 232 something happened. Error: PHP Warning: Class 'Paralleltest' not found in /home/sayan/Documents/Programming/testing/vendor/opis/closure/src/SerializableClosure.php on line 232 something happened. Error: PHP Warning: Class 'Paralleltest' not found in /home/sayan/Documents/Programming/testing/vendor/opis/closure/src/SerializableClosure.php on line 232 something happened. Error: PHP Warning: Class 'Paralleltest' not found in /home/sayan/Documents/Programming/testing/vendor/opis/closure/src/SerializableClosure.php on line 232 goodbye from parent. Time taken: 0 |
Note, if I replace
with
|
Yeah, you cannot simply reference the Take a look at tasks if you want to better structure your code: https://github.com/spatie/async#working-with-tasks I'm going to close this issue for now, as there doesn't seem to be a problem in the package. But feel free to keep commenting. |
Thank you. If the README.md could be updated with a simple example of this library working in an object-oriented setup (similar to the async/await examples, with actual code), it would be really helpful! I had a look at the Tasks link, but the usage wasn't exactly clear to me. |
yes sayanb real case examples are not found..did you found any codes related to this??if so kindly reply me. |
I'm in the same position, with codeigniter 3 project as well. Did you find any solution to this? |
My code:
Output:
something happened, exception. Error:
something happened, exception. Error:
something happened, exception. Error:
something happened, exception. Error:
something happened, exception. Error:
something happened, exception. Error:
something happened, exception. Error:
something happened, exception. Error:
something happened, exception. Error:
something happened, exception. Error:
How do I debug the issue? The exception message doesn't seem to be showing. If I just log the exception, instead of the message, I get:
something happened, exception. Error: Spatie\Async\Output\ParallelError in /home/sayan/Documents/Programming/spatie_test/vendor/spatie/async/src/Output/ParallelError.php:11
Stack trace:
#0 /home/sayan/Documents/Programming/spatie_test/vendor/spatie/async/src/Process/ParallelProcess.php(126): Spatie\Async\Output\ParallelError::fromException('')
#1 /home/sayan/Documents/Programming/spatie_test/vendor/spatie/async/src/Process/ProcessCallbacks.php(51): Spatie\Async\Process\ParallelProcess->resolveErrorOutput()
#2 /home/sayan/Documents/Programming/spatie_test/vendor/spatie/async/src/Pool.php(197): Spatie\Async\Process\ParallelProcess->triggerError()
#3 /home/sayan/Documents/Programming/spatie_test/vendor/spatie/async/src/Pool.php(285): Spatie\Async\Pool->markAsFailed(Object(Spatie\Async\Process\ParallelProcess))
#4 /home/sayan/Documents/Programming/spatie_test/vendor/spatie/async/src/Runtime/ParentRuntime.php(70): Spatie\Async\Pool->Spatie\Async{closure}(17, Array)
#5 /home/sayan/Documents/Programming/spatie_test/vendor/spatie/async/src/helpers.php(15): Spatie\Async\Runtime\ParentRuntime::createProcess(Object(Closure))
#6 /home/sayan/Documents/Programming/spatie_test/test.php(84): async(Object(Closure))
#7 /home/sayan/Documents/Programming/spatie_test/test.php(50): Test->getListings(Object(DOMElement))
#8 /home/sayan/Documents/Programming/spatie_test/test.php(221): Test->process()
#9 {main}
The text was updated successfully, but these errors were encountered: