The company I work has changed Zend_Db_Statement_Sqlsrv class of Zend (v1) to add some extended features, one of them being a query timeout. At the statement execution (line below), we are adding a new setting:
$options['QueryTimeout'] = $this->query_timeout; //this is the new line
$this->_stmt = sqlsrv_query($connection, $query, $params, $options);
Debugging the $options array I can confirm the value is set correctly and seems to be working fine in some instances, but not in others. In my instance, if I manually set timeout to 60 seconds, the query is aborted as expected.
If timeout is 300, it's not aborted. Tested some other values and it seems inconsistent, but around 100 and 180 seconds it starts to get ignored and timeout is not applied, making the query run until end.
It also seems the query (or the data) can contribute to this behavior, as some queries are not having this issue.
So, my question is: is there anything on SQL side that could prevent query abortion as configured on PHP? Please note that the error occurs on same server without any configuration change, only the timeout value being different.
It all seems very strange, appreciate any help or direction to follow.