How I “fixed” Segmentation Fault in Codeception 2.1.3

I hit on a bug when upgrading from Codeception 1.8.x to Codeception 2.1.3.

I entirely skipped the 2.0.* branch of Codeception, not through any other reason than 1.8.x was working fine for me.

During a recent site update, I decided it would be a good time to update the Codeception tests suite to the latest release.

Unfortunately, the upgrade did not go smoothly.

I constantly hit this issue, but only with the Acceptance test suite. The unit tests passed absolutely fine.

I even got very specific with my versions inside composer.json:

(some other stuff removed for brevity)

But still I hit the Segmentation Fault error every single time I ran the acceptance tests.

My Fix

Alas, my fix isn’t great. But it has worked.

I figured with the major version changing, chances are something went pear shaped internally.

My test suite isn’t hugely customised, but it did have a bit of extra stuff sprinkled in here and there. Something in there may very well have caused it.

Anyway, after much debugging (difficult as it happens), I gave up and did the following:

  1. Renamed the tests/ dir to tests_bak
  2. Renamed codeception.yml dir to codeception_bak.yml
  3. Ran php vendor/codeception/codeception/codecept bootstrap

And then, piece by piece, copied all my tests and config back across to the respective files.

Don’t copy / overwrite.

Instead, copy the relevant bits from the files – especially the configs. Things have changed.

Also, I found it easiest to re-run the test suite for every individual file I copied over. One by one at first, but as I copied in more of the directories, I ended up getting quicker and quicker.

Not the most elegant of solutions, but the test suite is back to working.

Interested in learning more about Codeception? I have a full course on the site.

Ahh, but it returns…

I wanted to add something extra to this.

I hit this issue again in Codeception 2.1.3.

From what I can discern, the size of your test database (e.g. dump.sql ) seems to have some impact on causing the Segmentation Fault issue.

I found that by removing data from my tables – generally less than 50 rows per table – the Segmentation Fault issue went away.

Frustrating that I don’t know the exact cause of it, but if in doubt, strip it out.


Published by

Code Review

Code Review

CodeReviewVideos is a video training site helping software developers learn Symfony faster and easier.

Leave a Reply

Your email address will not be published. Required fields are marked *