troygilbert

Experience

5,870

0 Best Reply Awards

  • Member Since 3 Years Ago
  • 115 Lessons Completed
  • 0 Favorites

1st February, 2017

troygilbert left a reply on Saving An Intervention Image Instance Into Amazon S3 • 1 year ago

The Image::__toSring() method is equivalent to Image::getEncoded()

24th January, 2017

troygilbert left a reply on My Queue Workers Run Out Of Memory And Die Once Or Twice A Day • 1 year ago

No, I haven't resolved it. But it did go away. Its been at least weeks since it's happened.

21st October, 2016

troygilbert started a new conversation My Queue Workers Run Out Of Memory And Die Once Or Twice A Day • 1 year ago

Since upgrading to Laravel 5 (5.3.x) (from 4.2), I've noticed that my queue workers (which are daemons) run out of memory and die every 12 hours or so:

Symfony\Component\Debug\Exception\FatalErrorException: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) 
in /home/forge/example.com/releases/20161020233025/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:91

I've got 8 jobs, all but one are scheduled to happen once per day. The 8th job, which runs every minute, performs a fairly straightforward query of a single table in my MySQL DB (basically looking for expired items). I then execute a simple job for each expired item.

Unless we are pushing test data through the system, this query only returns results once a day, at about 10:30am. The last two memory errors occurred at 11:40am and the previous day at 4:20pm, so they don't appear to be directly correlated with the executing of jobs.

I've double-checked, I don't have DB::enableQueryLog() anywhere, and if I understand correctly, Laravel 5 disables it by default.

I'm kinda at a loss of how to track down a memory leak like this. My jobs and commands don't open any files, or allocate any resources from external libraries, so there's nothing to manually release. The only thing that happens is a single DB query each minute. Feels like that shouldn't leak memory.

Another tidbit of info: I have two queue workers, and they both die with out-of-memory errors. One time they died within 2 seconds of each other, the other time they died 8 minutes apart from each other. (I don't have a preserved log of crashes further back than that.)

I guess it's not really a problem that they run out of memory. The workers crash, supervisor fires them back up, everything keeps going. I'm guessing it'd be more of a problem if it leaked memory then ran out in the middle of an important job instead of just during an idle period.

Thanks in advance for any suggestions.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.