Homestead: Homestead memory leak with Z-Ray

Created on 9 Mar 2018  路  1Comment  路  Source: laravel/homestead

Versions

  • Vagrant: 2.0.2
  • Provider: Virtualbox
  • Homestead: 5.1.0

Homestead.yaml

ip: 192.168.10.10
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
    - ~/.ssh/id_rsa
folders:
    -
        map: ___
        to: ___
sites:
    -
        map: ___
        to: ___
        schedule: true
databases:
    - homestead
name: code
hostname: code

Expected behavior

Z-Ray data collection shouldn't be enabled by default.

Actual behavior

Z-Ray collect queries even though zray: 'true' is not set on Homestead.yaml. This cause huge memory leak when running a large number of queries on an artisan command (on the CLI).

Temporary fix

Add the following in the __construct method of your command.

if (function_exists('zray_disable')){
    zray_disable(true);
}

Notes

Even if you'll decide to do nothing about it, I thought it would be useful to leave it here for future reference. I got crazy looking for the cause of the leak.

Most helpful comment

thanks for the report @micc83 . we actually discovered this issue a couple days ago in the Slack channel. It seems to only affect php7.2 on the CLI.

I have personally run into the issue running database seeds. The solution for now is to use php 7.1

php7.1 artisan db:seed

We are planning a fix and a new box release in the next couple weeks.

Here is the relevant settler PR. https://github.com/laravel/settler/pull/145/files

>All comments

thanks for the report @micc83 . we actually discovered this issue a couple days ago in the Slack channel. It seems to only affect php7.2 on the CLI.

I have personally run into the issue running database seeds. The solution for now is to use php 7.1

php7.1 artisan db:seed

We are planning a fix and a new box release in the next couple weeks.

Here is the relevant settler PR. https://github.com/laravel/settler/pull/145/files

Was this page helpful?
0 / 5 - 0 ratings