Opened 23 months ago
Last modified 19 months ago
#743 infoneeded_new defect
PHPCodeSniffer Task runs out of memory
| Reported by: | anonymous | Owned by: | mrook |
|---|---|---|---|
| Priority: | major | Milestone: | Icebox |
| Component: | phing-tasks-ext | Version: | 2.4.6 |
| Keywords: | Cc: |
Description
I'm working on an open source project with a relatively long history of people ignoring the coding standards, so I have a huge code base with many violations. So many violations, in fact, that with the project's custom coding style configuration Phing and PHPCodeSniffer consume all available memory shortly after reaching the halfway point of processing the code base (even using a long exclude list which excludes third party libraries and non-php files).
Looking at the code for the PHPCodeSniffer task, I think I've found the culprit. All warnings and errors are stored in memory until the run is finished and then copied and written to disk at the end of the run. Obviously, this doesn't scale well with project size. I'm using Jenkins to automate the runs and I've had to kill Phing because of memory exhaustion on a number of occasions. For example, in one instance I left the process to run over the weekend and it still hadn't completed after 60 hours, for a process that can take as little as an 1 hour when it's not running out of memory.
I can work around this by adding additional targets to Phing or reducing the number and variety of violations I check for. However, a permanent solution would be for Phing to periodically write the errors out to disk instead of keeping them all in memory until execution is finished. You might be tempted to think that it's a PHPCodeSniffer problem, but it looks like the output is actually being managed by Phing's PHPCodeSnifferTask.
Attachments (0)
Change History (3)
comment:1 Changed 23 months ago by mrook
- Component changed from phing-core to phing-tasks-ext
- Milestone changed from TBD to 2.4.7
- Priority changed from tbd to major
comment:2 Changed 22 months ago by mrook
Can you try running phpcs on your code base - the standalone version? I'd like to know how it compares.
comment:3 Changed 19 months ago by mrook
- Milestone changed from 2.4.8 to TBD
- Status changed from new to infoneeded_new

Thanks for the in-depth report, assigning this to the 2.4.7 milestone.