Modify

Opened 3 years ago

Closed 2 weeks ago

#743 closed defect (nofeedback)

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 (4)

comment:1 Changed 3 years 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

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

comment:2 Changed 3 years 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 3 years ago by mrook

  • Milestone changed from 2.4.8 to TBD
  • Status changed from new to infoneeded_new

comment:4 Changed 2 weeks ago by mrook

  • Resolution set to nofeedback
  • Status changed from infoneeded_new to closed

Add Comment

Modify Ticket

Action
as closed The owner will remain mrook.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.