inspector-laravel: Undefined property: Inspector\Laravel\Inspector::$transaction

Describe the bug Inspector randomly throws this error

To Reproduce Cant’ find a way to reproduce. Seems this error occurs when running scheduled jobs.

Expected behavior Not thrown any error

Screenshots

Web (please complete the following information):

  • Package Version 4.7.2
  • Laravel / Lumen version 7.30.4

Additional context

Undefined property: Inspector\Laravel\Inspector::$transaction File ../vendor/inspector-apm/inspector-php/src/Inspector.php Line 109
#0  ..vendor/inspector-apm/inspector-php/src/Inspector.php(109): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1  ..vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Inspector\Inspector->currentTransaction()
#2  ..vendor/inspector-apm/inspector-laravel/src/Providers/JobServiceProvider.php(121): Illuminate\Support\Facades\Facade::__callStatic()
#3  ..vendor/inspector-apm/inspector-laravel/src/Providers/JobServiceProvider.php(65): Inspector\Laravel\Providers\JobServiceProvider->handleJobEnd()
#4  ..vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(381): Inspector\Laravel\Providers\JobServiceProvider->Inspector\Laravel\Providers\{closure}()
#5  ..vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(226): Illuminate\Events\Dispatcher->Illuminate\Events\{closure}()
#6  ..vendor/laravel/framework/src/Illuminate/Queue/Worker.php(540): Illuminate\Events\Dispatcher->dispatch()
#7  ..vendor/laravel/framework/src/Illuminate/Queue/Worker.php(392): Illuminate\Queue\Worker->raiseExceptionOccurredJobEvent()
#8  ..vendor/laravel/framework/src/Illuminate/Queue/Worker.php(360): Illuminate\Queue\Worker->handleJobException()
#9  ..vendor/laravel/framework/src/Illuminate/Queue/Worker.php(306): Illuminate\Queue\Worker->process()
#10 ../vendor/laravel/framework/src/Illuminate/Queue/Worker.php(132): Illuminate\Queue\Worker->runJob()
#11 ../vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(112): Illuminate\Queue\Worker->daemon()
#12 ../vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(96): Illuminate\Queue\Console\WorkCommand->runWorker()
#13 ../vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#14 ../vendor/laravel/framework/src/Illuminate/Container/Util.php(37): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#15 ../vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#16 ../vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#17 ../vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\Container\BoundMethod::call()
#18 ../vendor/laravel/framework/src/Illuminate/Console/Command.php(134): Illuminate\Container\Container->call()
#19 ../vendor/symfony/console/Command/Command.php(288): Illuminate\Console\Command->execute()
#20 ../vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#21 ../vendor/symfony/console/Application.php(974): Illuminate\Console\Command->run()
#22 ../vendor/symfony/console/Application.php(291): Symfony\Component\Console\Application->doRunCommand()
#23 ../vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun()
#24 ../vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run()
#25 ../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#26 ../artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#27 {main}

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

Inside the artisan command, we have a dispatch(new Import($data)). Inside the Import job, we run also another dispatch(new Execute($data)). This dispatch will execute in a for loop.

foreach ($array as $data) {
dispatch(new Execute($data));
}

Inside the Execute job, we run a third job dispatch(new Save($data)), this dispatch is also running in a for loop. When the Execute is finished in the first row of the loop (so will be the Save jobs), the error will appear.

This all above is when the queue is set to sync. So the dispatch doesn’t really matter (Local).

I hope I have explained the situation well and clearly.