Page MenuHomePhabricator

Slow test UploadFromUrlTest::testSyncDownload due to PHPUnit enumerator
Closed, ResolvedPublic

Description

When I run PHPUnit locally against MediaWiki core only, it hangs for 5 minutes while tearing down UploadFromUrlTest::testSyncDownload. During that time, memory usage increases by about 3GB.

The test is unusual in that it returns an array. This causes TestCase::shouldInvocationMockerBeReset() to call Enumerator::enumerate() on the return value, which is where I find it when I capture a stack trace with gdb.

The array has a FauxRequest with a Session, which then links to SessionBackend then HookRunner, ObjectFactory and the whole kitchen sink.

Enumerator::enumerate() uses a loop of array_merge() and so probably has O(N^2) time order.

Event Timeline

Change #1192095 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] Fix slow test UploadFromUrlTest::testSyncDownload()

https://gerrit.wikimedia.org/r/1192095

Change #1192095 merged by jenkins-bot:

[mediawiki/core@master] Fix slow test UploadFromUrlTest::testSyncDownload()

https://gerrit.wikimedia.org/r/1192095

kostajh claimed this task.
kostajh reassigned this task from kostajh to tstarling.
kostajh subscribed.