Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when using junit format. #1103

Open
OJezu opened this issue Nov 9, 2017 · 6 comments · May be fixed by #1423
Open

Memory leak when using junit format. #1103

OJezu opened this issue Nov 9, 2017 · 6 comments · May be fixed by #1423
Labels

Comments

@OJezu
Copy link

OJezu commented Nov 9, 2017

Our tests complete with memory utilization ~110MB when using "pretty" or "progress" formats, but when using "junit" format, they fail after trying to exceed 256MB php memory limit. When run without memory limits with "junit" formater, our test suite completes, but only after taking ~290MB of memory.

Issue seems to be caused by Symfony annotation cache not being garbage collected when junit format is used.

screenshot from 2017-11-09 16-42-53
screenshot from 2017-11-09 16-42-43

Versions used:

behat/behat                              v3.4.1
behat/gherkin                            v4.5.1
behat/mink                               v1.7.1
behat/mink-browserkit-driver             v1.3.2
behat/mink-extension                     v2.2
behat/mink-goutte-driver                 v1.2.1
behat/symfony2-extension                 2.1.1
behat/transliterator                     v1.2.0
symfony/symfony                          v3.4.0-BETA3
@stof
Copy link
Member

stof commented Nov 10, 2017

This is really weird, because there should be no relations at all between the Symfony annotation cache and the Behat JUnit formatter.

Can you share the actual backfire profiles rather than some screenshots, to let us explore them more ?

@OJezu
Copy link
Author

OJezu commented Nov 14, 2017

Sorry for the delay, here are the profiles:
https://blackfire.io/profiles/30fc94e0-8f8b-4032-bb19-41e1001bddff/graph
https://blackfire.io/profiles/ae85bd97-b838-4d6d-ad7e-ced36e8a7547/graph

And comparsion:

https://blackfire.io/profiles/compare/d543aa8b-c7c6-4496-b5e1-c35722d3cb71/graph

Here is the bash script we are using to set-up environment for behat tests to make sure they are repeatable:

#!/bin/bash

set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

PHP_DEBUG_RUNTIME="php-debug"
PHP_RUNTIME="php"
BLACKFIRE_RUNTIME="blackfire run php"

if [[ $1 == '--with-debugger' || $1 == '--debugger' ]]
then
    phpRuntime="$PHP_DEBUG_RUNTIME"
    behatArgs=( "${@:2}" )
elif [[ $1 == '--with-blackfire' || $1 == '--blackfire' ]]
then
    phpRuntime="$BLACKFIRE_RUNTIME"
    behatArgs=( "${@:2}" )
else
    phpRuntime="$PHP_RUNTIME"
    behatArgs=( "$@" )
fi

rm -rf $DIR/../var/cache/test/*
$DIR/console cache:warm --env=test --no-debug

$DIR/console doctrine:database:drop --env=test --force
$DIR/console doctrine:schema:create --env=test
$phpRuntime -d memory_limit=256M $DIR/behat "${behatArgs[@]}"
RESULT=$?
$DIR/console doctrine:database:drop --env=test --force
rm -rf $DIR/../var/cache/test/*

exit $RESULT

@everzet everzet added the Bug label Nov 19, 2017
@OJezu
Copy link
Author

OJezu commented Nov 20, 2017

@stof Have you looked at those profiles? They will disappear in a week, AFAIK.

@oniric85
Copy link

We are experimenting similar issues when adding the JUnit output to our behat execution. Our limits are set to 128 MB and everything runs fine when using only progress or default outputs.

@ayalacp
Copy link

ayalacp commented Jan 31, 2022

anyone have any luck here? having similar issues

@thomandre
Copy link

We are having the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants