Page MenuHomePhabricator

Invalid argument supplied for foreach() in SwiftFileBackend
Closed, ResolvedPublic

Description

These errors seem to come in pairs and recur quite often in the fatalmonitor/apache2 logs:

PHP Warning: Invalid argument supplied for foreach() in /usr/local/apache/common-local/php-1.23wmf10/includes/filebackend/SwiftFileBackend.php on line 180

PHP Warning: Invalid argument supplied for foreach() in /usr/local/apache/common-local/php-1.23wmf10/includes/filebackend/SwiftFileBackend.php on line 648

$ fgrep "SwiftFileBackend.php on line 180" /a/mw-log/apache2.log |wc -l
927

$ fgrep "SwiftFileBackend.php on line 648" /a/mw-log/apache2.log |wc -l
927

Version: 1.23.0
Severity: normal

Details

Reference
bz60477

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:05 AM
bzimport set Reference to bz60477.

I think this is caused by SwitftFileBackend::addMissingMetadata(). This method is documented to return an array and used as though it will always return an array but the current implementation will only return an array in the "happy path" use case where the header collection passed to it already contains the 'x-object-meta-sha1base36' header. In all other execution paths it returns a boolean rather than an array.

Change 109690 had a related patch set uploaded by BryanDavis:
Always return an array from SwiftFileBackend::addMissingMetadata

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

Change 109690 merged by jenkins-bot:
Always return an array from SwiftFileBackend::addMissingMetadata

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

was successfully merged

The log messages from the original report are no longer being seen in the fatal log monitor now that all wikis are on 1.23wmf12 or newer.

Gilles raised the priority of this task from Normal to Unbreak Now!.Dec 4 2014, 10:25 AM
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to Normal.Dec 4 2014, 11:21 AM