3

我正在使用带有PHP 5.4.21标准AMI的Amazon Linux 64位在Amazon Elastic Beanstalk上运行Laravel 4.0应用程序。

每当git aws.push完成或者当Amazon的默认日常cron作业运行时(这会导致Apache重新启动),我的应用程序突然在Eloquent基础模型创建调用中出现异常,直到我重新启动Apache,有时甚至是1-2次。从那时起,服务器将正常运行,直到下一次重新启动的Apache(通过日常工作或混帐推等),为简洁

[2013-12-22 19:34:52] log.ERROR: Exception in orderProcessor->process: 
exception 'ErrorException' with message 'Undefined property: 
MyApp\Store\Order::$attributes' in /v/a/c/bootstrap/compiled.php:6266 
Stack trace: 
#0 /v/a/c/bootstrap/compiled.php(6266): Illuminate\Exception\Handler->handleError(8, 'Undefined prope...', '/v/a/c...', 6266, Array) 
#1 /v/a/c/bootstrap/compiled.php(6461): Illuminate\Database\Eloquent\Model->getAttribute('attributes') 
#2 /v/a/c/bootstrap/compiled.php(6379): Illuminate\Database\Eloquent\Model->__get('attributes') 
#3 /v/a/c/bootstrap/compiled.php(5530): Illuminate\Database\Eloquent\Model->syncOriginal() 
#4 /v/a/c/bootstrap/compiled.php(5589): Illuminate\Database\Eloquent\Model->__construct(Array) 
#5 /v/a/c/app/MyApp/Store/Repositories/EloquentOrderRepository.php(62): Illuminate\Database\Eloquent\Model::create(Array) 
#6 /v/a/c/app/MyApp/Store/OrderProcessor.php(65): MyApp\Store\Repositories\EloquentOrderRepository->create(Array) 
#7 /v/a/c/app/controllers/StoreController.php(122): MyApp\Store\OrderProcessor->process(Object(MyApp\User), Object(MyApp\Store\Cart)) 
... controller and route calls ... 

/V/A/C =在/ var /应用/电流。 MyApp\Store\Order延伸Eloquent

我真的不知道如何诊断并最终解决此问题,并寻求建议。

更新:我删除了下面要求的调用函数,因为它们看起来不相关。他们通过了所有测试,并成功处理了数千个订单。至少有一个基于Eloquent的模型(即MyApp\User)在调用create()时也会发生,直到Apache重启1-2次。

+0

你可以发布'process'方法吗?这不是一个抛出异常吗?你看过这个方法的调用者吗? – kukido

+0

在Laravel的Model类中,在getAttribute()函数中发生异常,特别是对array_key_exists($ key,$ this-> attributes)的调用。 $ this-> attributes,不知何故不存在,即使它初始化为类中的空数组。 –

回答

0

增加我的虚拟机从2GB到4GB的RAM数量似乎已经解决了我的这个问题。事实证明,渴望加载是内存饥饿。

0

将php.ini的内存使用量从512M增加到1024M对我来说没有任何作用。