From 556b95c7c191488ff6884365dcdb3a280671685e Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 12 May 2024 20:45:41 +1000 Subject: [PATCH] Fix when dispatching packets, and our address object has many relations already loaded, causing memory exhaustion due to recursion --- app/Classes/File/Receive.php | 4 ++-- app/Jobs/PacketProcess.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Classes/File/Receive.php b/app/Classes/File/Receive.php index 8dd2b8c..b2f192f 100644 --- a/app/Classes/File/Receive.php +++ b/app/Classes/File/Receive.php @@ -128,10 +128,10 @@ class Receive extends Base // If packet is greater than a size, lets queue it if ($this->queue || ($this->receiving->size > config('fido.queue_size',0))) { Log::info(sprintf('%s:- Packet [%s] will be sent to the queue for processing because its [%d] size, or queue forced',self::LOGKEY,$this->receiving->full_name,$this->receiving->size)); - PacketProcess::dispatch($this->receiving,$this->ao,$rcvd_time); + PacketProcess::dispatch($this->receiving,$this->ao->withoutRelations(),$rcvd_time); } else - PacketProcess::dispatchSync($this->receiving,$this->ao,$rcvd_time); + PacketProcess::dispatchSync($this->receiving,$this->ao->withoutRelations(),$rcvd_time); } catch (\Exception $e) { Log::error(sprintf('%s:! Got error dispatching packet [%s] (%d:%s-%s).',self::LOGKEY,$this->receiving->full_name,$e->getLine(),$e->getFile(),$e->getMessage())); diff --git a/app/Jobs/PacketProcess.php b/app/Jobs/PacketProcess.php index acb4a7e..5b57b7f 100644 --- a/app/Jobs/PacketProcess.php +++ b/app/Jobs/PacketProcess.php @@ -111,9 +111,9 @@ class PacketProcess implements ShouldQueue try { // Dispatch job. if ($queue) - MessageProcess::dispatch($msg,$f->pktName(),$this->ao,$pkt->fftn_o,$this->rcvd_time); + MessageProcess::dispatch($msg,$f->pktName(),$this->ao->withoutRelations(),$pkt->fftn_o->withoutRelations(),$this->rcvd_time); else - MessageProcess::dispatchSync($msg,$f->pktName(),$this->ao,$pkt->fftn_o,$this->rcvd_time); + MessageProcess::dispatchSync($msg,$f->pktName(),$this->ao->withoutRelations(),$pkt->fftn_o->withoutRelations(),$this->rcvd_time); } catch (\Exception $e) { Log::error(sprintf('%s:! Got error dispatching message [%s] (%d:%s-%s).',self::LOGKEY,$msg->msgid,$e->getLine(),$e->getFile(),$e->getMessage()));