Skip to content

Conversation

@enjoy-binbin
Copy link
Contributor

@enjoy-binbin enjoy-binbin commented Mar 14, 2024

Users who abuse lua error_reply will generate a new error object on each
error call, which can make server.errors get bigger and bigger. This will
cause the server to block when calling INFO (we also return errorstats by
default).

To prevent the damage it can cause, when a misuse is detected, we will
print a warning log and disable the errorstats to avoid adding more new
errors. It can be re-enabled via CONFIG RESETSTAT.

Because server.errors may be very large (it may be better now since we
have the limit), config resetstat may block for a while. So in
resetErrorTableStats, we will try to lazyfree server.errors.

See the related discussion at the end of #8217.

log output:

89253:M 18 Mar 2024 16:56:08.886 # Errorstats stopped adding new errors because the number of errors reached the limit, may be misuse of lua error_reply, please check INFO ERRORSTATS, this can be re-enabled via CONFIG RESETSTAT.
89253:M 18 Mar 2024 16:56:08.886 # Current errors code list: 1, 10, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 11, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 12, 120, 121, 122, 123, 124, 125, 126, 127, 128, 13, 14, 15, 16, 17, 18, 19, 2, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 3, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 4, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 5, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 6, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 7, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 8, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 9, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99

after disabled, info errorstats output:

# Errorstats
errorstat_ERRORSTATS_DISABLED:count=1

Users who abuse lua error_reply will generate a new error object on each
error call, which can make server.errors get bigger and bigger. This will
cause the server to block when calling INFO (we also return errorstats by
default).

To prevent the damage it can cause, when a misuse is detected, we will
print a warning log and disable the errorstats to avoid adding more new
errors. It can be re-enabled via CONFIG RESETSTAT.

Because server.errors may be very large (it may be better now since we
have the limit), config resetstat may block for a while. So in
resetErrorTableStats, we will try to lazyfree server.errors.

See the related discussion at the end of redis#8217.
@enjoy-binbin enjoy-binbin requested a review from oranagra March 14, 2024 08:50
@oranagra oranagra merged commit e04d41d into redis:unstable Mar 19, 2024
@enjoy-binbin enjoy-binbin deleted the info_errorstats branch March 19, 2024 06:23
@enjoy-binbin
Copy link
Contributor Author

i guess we should mark it as release notes? or need to explain this new error code ERRORSTATS_DISABLED in the info errorstats of redis-doc?

@oranagra
Copy link
Member

since this is only triggered by a misuse that i imagine is very rare, i figured that we don't need to mention it, but i suppose it won't harm either.
but you're right that we better document it, if we can find a good place to do it.

@oranagra oranagra added the release-notes indication that this issue needs to be mentioned in the release notes label Mar 19, 2024
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
redis#13141)

Users who abuse lua error_reply will generate a new error object on each
error call, which can make server.errors get bigger and bigger. This
will
cause the server to block when calling INFO (we also return errorstats
by
default).

To prevent the damage it can cause, when a misuse is detected, we will
print a warning log and disable the errorstats to avoid adding more new
errors. It can be re-enabled via CONFIG RESETSTAT.

Because server.errors may be very large (it may be better now since we
have the limit), config resetstat may block for a while. So in
resetErrorTableStats, we will try to lazyfree server.errors.

See the related discussion at the end of redis#8217.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-notes indication that this issue needs to be mentioned in the release notes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants