Skip to content

Commit

Permalink
SMK-1394: Infinite loop on close connection
Browse files Browse the repository at this point in the history
This is affecting consumers when it takes more than 2*heartbeat time to process a message.
When trying to close the connection, library will:
* check the heartbeat
* detect that it passed more than 2*times the heartbeat value without receiving anything
* considers that server has gone away and tries to reconnect
* after reconnecting as it is not clearing internal variables with time of last read, it will check the heartbeat again and try to reconnect again in loop.

There are already issues on the library's github: php-amqplib#309 and php-amqplib#413
  • Loading branch information
ruicampos committed Apr 21, 2017
1 parent 35eb1f0 commit 900dfbd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions PhpAmqpLib/Wire/IO/StreamIO.php
Expand Up @@ -353,6 +353,9 @@ public function close()
fclose($this->sock);
}
$this->sock = null;
// Reset last_read and last_write
$this->last_read = null;
$this->last_write = null;
}

/**
Expand Down

0 comments on commit 900dfbd

Please sign in to comment.