I'm running a Laravel 4.0 application on Amazon Elastic Beanstalk using the Amazon Linux 64-bit with PHP 5.4.21 standard AMI.
Whenever a git aws.push completes or when Amazon's default daily cron jobs run (which causes Apache to restart), my application suddenly has exceptions in Eloquent based-model create calls until I restart Apache, sometimes 1-2 times. From then on, the server will run normally until the next Apache restart (via daily job or git push, etc.)
[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/app/current for brevity. MyApp\Store\Order extends Eloquent.
I'm really at a loss as to how to diagnose and ultimately fix this issue and am seeking advice.
Update: I've removed the calling functions that were requested below as they don't seem relevant. They pass all tests, and have been successfully processing thousands of orders. This happens with at least one other Eloquent-based model (i.e. MyApp\User) when calling create() on it too until Apache is restarted 1-2 times.
processmethod? Isn't it the one throwing exception? Did you look into who are the callers for the method?