title: Error: [8] PDO::__construct(): send of 5 bytes failed with errno=32 Broken pipe
body: <p>I keep randomly getting following error:</p>
  
  <pre><code>Error: [8] PDO::__construct(): send of 5 bytes failed with errno=32 Broken pipe
  </code></pre>
  
  <p>in /var/www/test/includes/classes/class.Database.php on line 33</p>
  
  <p>All was fine till I upgraded Maria DB to 10.2.xx
  server set up is:</p>
  
  <pre><code>PHP 7.0.27-0+deb9u1 (cli) (built: Jan  5 2018 13:51:52) ( NTS )
  mysql  Ver 15.1 Distrib 10.2.13-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
  </code></pre>
  
  <p>I tried to increase <code>wait_timeout</code> and <code>max_allowed_packet</code> I also enabled <code>pdo_mysql</code> but doesn't seems made any difference.
  Does anyone knows where can be a problem?
  I would suspect upgrade of Maria DB from 10.1.xx to 10.2.xx since before upgrade I haven't seen such error, even tho I switched from Ubuntu 16.04 to Debian 9.</p>
  
  <pre><code>public function __construct($host, $user,$pass, $dbname, $charset, $prefix){
      $this-&gt;host = $host;
      $this-&gt;user = $user;
      $this-&gt;pass = $pass;
      $this-&gt;dbname = $dbname;
      $this-&gt;charset = $charset;
      $this-&gt;prefix = $prefix;
  
      // Set DSN
      $dsn = 'mysql:host='.$this-&gt;host.';dbname='.$this-&gt;dbname.';charset='.$this-&gt;charset;
      // Set options
      $options = array(
          PDO::ATTR_PERSISTENT =&gt; true,
          PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION,
          PDO::ATTR_EMULATE_PREPARES =&gt; true
      );
      // Create a new PDO instanace
      try{
          $this-&gt;dbh = new PDO($dsn, $this-&gt;user, $this-&gt;pass, $options); //this is line 33
      }
      // Catch and log all errors
      catch(PDOException $e){
          $this-&gt;error = $e-&gt;getMessage();
          error_log($e-&gt;getMessage());
      }
  }
  </code></pre>