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

Build never finishes when using codeception #217

Closed
jwmwalrus opened this issue Oct 2, 2018 · 7 comments
Closed

Build never finishes when using codeception #217

jwmwalrus opened this issue Oct 2, 2018 · 7 comments

Comments

@jwmwalrus
Copy link
Contributor

Hi.

In order to get a much more accurate value of coverage (as I mentioned in #216), I'm trying to test running the equivalent acceptance suite using codeception.

Even though running the current tests should not take more than 20 minutes (and codeception's log at /var/www/php-censor/runtime/builds/1/116_36f93be7/tests/_output/acceptance-2018-10-02 shows that all the tests already passed), PHP Censor's webview still keeps showing Codeception step as running ---and it never finishes doing so.

After php-censor.queue.lifetime's time value is reached (in my case, 6000), then the log shows the infamous Cant build - status is not pending`. The only way to stop the build it is to delete it.

Codeception-related config is:

test:
    codeception:
        config: "codeception.dist.yml"
        args: "acceptance tests/acceptance/ConfigBundle --coverage-html --html"

Environment

  • PHP Censor version: 0.23.0-23-gd6d11ad8
  • Operating System: Debian GNU/Linux 9.5 (stretch)
  • PHP version: 7.2.9-1+0~20180910100512.5+stretch~1.gbpdaac35
  • MySQL/PostgreSQL version: 15.1 Distrib 10.1.26-MariaDB
@corpsee
Copy link
Member

corpsee commented Oct 2, 2018

@jwmwalrus Thanks!

@corpsee
Copy link
Member

corpsee commented Oct 6, 2018

@jwmwalrus I see two probable causes:

  1. Codeception process still working for some reasons.
  2. PHP Censor worker died for some reasons and build freezed on running status.

Can you stop PHP Censor worker, run worker command manually from console and start same build? Worker died in the building process?

@jwmwalrus
Copy link
Contributor Author

Hi.

I did as you said (I guess):

  • Stopped PHP Censor workers (though supervisor)
  • Started the worker manually with
    www-data@git:~/php-censor$ bin/console php-censor:worker -vvv
  • Started the build from the web view

Everything runs as expected until the last two lines:

[2018-10-08 14:44:53] php-censor.INFO: PLUGIN: SUCCESS {"build":"[object] (PHPCensor\\Model\\Build\\GitBuild: {})"} []

[2018-10-08 14:44:53] php-censor.INFO:  RUNNING PLUGIN: Codeception (Stage: Test) {"build":"[object] (PHPCensor\\Model\\Build\\GitBuild: {})"} []

At this point, ps shows an instance of codecept running, along with the parent process that launched it:

root@git:~# ps -aux | grep codecept
www-data 11608  0.0  0.0   4288   728 pts/0    S+   14:44   0:00 sh -c cd "/var/www/php-censor/runtime/builds/1/116_0633d88b/" && /var/www/php-censor/runtime/builds/1/116_0633d88b/bin/codecept run -c "/var/www/php-censor/runtime/builds/1/116_0633d88b/codeception.dist.yml" --xml acceptance tests/acceptance/UsuariosBundle --coverage-html --html
www-data 11609  3.4  2.6 424064 105672 pts/0   S+   14:44   0:14 php /var/www/php-censor/runtime/builds/1/116_0633d88b/bin/codecept run -c /var/www/php-censor/runtime/builds/1/116_0633d88b/codeception.dist.yml --xml acceptance tests/acceptance/UsuariosBundle --coverage-html --html

The codecept process eventually finishes (and the report is generated in the _output directory), and ps no longer shows it as running.

But the worker is still hung at the php-censor.INFO: RUNNING PLUGIN: Codeception line.

I used a shorter acceptance suite this time (it runs in under 9 minutes), so it seems the PHP Censor is just waiting until the timeout (6000 secs.) is reached.

@corpsee
Copy link
Member

corpsee commented Oct 9, 2018

@jwmwalrus Thanks. I will try to reproduce and fix it.

corpsee added a commit that referenced this issue Nov 9, 2018
@corpsee corpsee closed this as completed Nov 9, 2018
EduardMalik added a commit to EduardMalik/php-censor that referenced this issue Feb 22, 2019
@EduardMalik
Copy link
Contributor

EduardMalik commented Feb 22, 2019

for get status process you use shell command: ps auxww | grep 'codeception' | grep -v grep
If i send commit - first test codeception runned.
I send second commit - for this commit codeception runned two.
But for first process, not finished before second process not killed. Because ps auxww | grep 'codeception' | grep -v grep show codeception as runned.
And i long waiting time for first commit, because i wait several codeception result.

And we use on this server second project, and codecept working by several hours for other project. And we wait several hours, instead several minutes for this small project with several tests.

And this code looks like hack. You can use symfony process isRunning function.
This working with proc_get_status and pid process. This is more compact and more readable. I send PR for this.

Pull request

EduardMalik added a commit to EduardMalik/php-censor that referenced this issue Feb 22, 2019
@jwmwalrus
Copy link
Contributor Author

The code is indeed a hack, but it's much better than the previous hack ;-)

Codeception doesn't exit properly ---i.e., the stdout stream remains open even after the codecept process---. While reimplementing the executeCommand interface in the CommandExecutor class, I tried the $process->isRunning method, and it always returned false (but if you manage to make it work, that'll be great).

In the current implementation of executeCommand, there's a filter to match the build path (which is unique for each running instance of codecept). Maybe that's what's not working properly?

@EduardMalik
Copy link
Contributor

what version codeception are you using?
what operating system?
I check on codeception 2.4.x with my desktop ubuntu 16.04, and two server with debian and centos 7. All work fine.

@corpsee corpsee removed this from the Version 1.0.* (patch) milestone May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants