1

I have a script that runs on the command line and does some mysql database processing (select data from one table, make some calculations and insert/update a different table). After some 10000 iterations, I repeatably get the following error:

DBALStatement::removeColons(): send of 5 bytes failed with errno=32 Broken pipe

This is the method in question:

public static function removeColons($params) : array
{
    $result = [];
    foreach ($params as $key => $val) {
        if ($key[0] == ':') {
            $key = substr($key, 1);
        }
        $result[$key] = $val;
    }

    return $result;
}

The line in which the error happens is the return statement:

    return $result;

I understand that broken pipes can happen when doing network or file operations or something, but how can I get this error on a simple return statement with no pipe anywhere near? What am I missing?

Edit: It seems that the broken pipe actually happens during the mysql query, which would make at bit more sense. I am currently still trying to figure out if this is a timeout problem or what. However, it is important to note that the method and line number reported in the PHP error log appear to be wrong in this instance, since the error clearly does not happen in the return statement. I would consider this a bug in the PHP error reporting.

Arno Schäfer
  • 277
  • 2
  • 8
  • Have you tried [this](https://stackoverflow.com/questions/1894317/mysql-pconnect-send-of-5-bytes-failed-with-errno-32-broken-pipe#answer-25386744)? – Ron van der Heijden Feb 13 '18 at 10:10
  • Why are you removing the colons from the keys? PDO expects them to be there, although it will work without them. – Barmar Feb 13 '18 at 10:15
  • possible `interactive_timeout` problem. Please check [https://serverfault.com/questions/375136/difference-between-wait-timeout-and-interactive-timeout](https://serverfault.com/questions/375136/difference-between-wait-timeout-and-interactive-timeout) – Cemal Feb 13 '18 at 11:03
  • @Barmar: that is because we are not using PDO, but Doctrine DBAL, which is a wrapper for many different database drivers. It is possible that all of them will work with colons too, but I am pretty sure that it works without, so that's what I am going with. Anyway, that was not my question. – Arno Schäfer Feb 13 '18 at 13:33
  • Regarding mysql timeouts: we are setting the interactive_timeout and wait_timeout to 8h, way longer than the time it breaks. – Arno Schäfer Feb 13 '18 at 17:07

0 Answers0