Skip to content

Commit b1d00fd

Browse files
Add an inexpensive liveness check and make challenge/response optional
See phpredis#1742 and countless other persistent connection issues.
1 parent 571dd96 commit b1d00fd

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

library.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,8 @@ redis_sock_check_liveness(RedisSock *redis_sock)
18101810
/* Check socket liveness using 0 second timeout */
18111811
if (php_stream_set_option(redis_sock->stream, PHP_STREAM_OPTION_CHECK_LIVENESS, 0, NULL) != PHP_STREAM_OPTION_RETURN_OK) {
18121812
return FAILURE;
1813+
} else if (!INI_INT("redis.pconnect.echo_check_liveness")) {
1814+
return SUCCESS;
18131815
}
18141816

18151817
if (redis_sock->auth) {

redis.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ PHP_INI_BEGIN()
9090
/* redis pconnect */
9191
PHP_INI_ENTRY("redis.pconnect.pooling_enabled", "1", PHP_INI_ALL, NULL)
9292
PHP_INI_ENTRY("redis.pconnect.connection_limit", "0", PHP_INI_ALL, NULL)
93+
PHP_INI_ENTRY("redis.pconnect.echo_check_liveness", "1", PHP_INI_ALL, NULL)
9394

9495
/* redis session */
9596
PHP_INI_ENTRY("redis.session.locking_enabled", "0", PHP_INI_ALL, NULL)

0 commit comments

Comments
 (0)