StackExchange.Redis icon indicating copy to clipboard operation
StackExchange.Redis copied to clipboard

ERR invalid expire time in psetex

Open Shad107 opened this issue 3 years ago • 8 comments

from time to time have error StackExchange.Redis.RedisServerException width ERR invalid expire time in psetex. I use a version 2.5.43 on netStandard 2.0 on redis server 6.2.6, after restart IIS service no error....

Shad107 avatar Mar 18 '22 09:03 Shad107

What was the error? Please always post the error message when filing an issue anywhere - the devs created them to help you debug :)

NickCraver avatar Mar 18 '22 10:03 NickCraver

Hello error message is 'ERR invalid expire time in psetex', log trace:

à StackExchange.Redis.ConnectionMultiplexer.ExecuteSyncImpl[T](Message message, ResultProcessor1 processor, ServerEndPoint server) à StackExchange.Redis.RedisBase.ExecuteSync[T](Message message, ResultProcessor1 processor, ServerEndPoint server)

Shad107 avatar Mar 18 '22 10:03 Shad107

This is like pulling teeth, please post the entire error message, not part of the trace.

It looks like you're calling the method with an invalid expiry argument, but actual details would help.

NickCraver avatar Mar 18 '22 10:03 NickCraver

I have not other message, I not example of data at this time

Shad107 avatar Mar 18 '22 10:03 Shad107

The best advice I have is look for the caller that's calling this set, it appears to be sending an invalid expiration value to the server, but I don't know the range offhand. My guess is it's passing 0.

NickCraver avatar Mar 18 '22 10:03 NickCraver

I added a log for more details, I'll get back to you as soon as I have news

Shad107 avatar Mar 18 '22 10:03 Shad107

@Shad107, that error is a RedisServer error, you are either passing in a negative value or a value that's slightly overflown a 64-bit signed integer to the PSETEX command. My money's on Negative because I don't think Timespans can be constructed from integers large enough to overflow.

slorello89 avatar Mar 23 '22 12:03 slorello89

@Shad107 any luck here?

NickCraver avatar May 28 '22 20:05 NickCraver

Not much info to add here, but we all of a sudden saw the same error:

{"type":"https://tools.ietf.org/html/rfc7231#section-6.6.1","title":"ERR invalid expire time in 'setex' command","status":500,"detail":" at Foundatio.Caching.HybridCacheClient.SetAsync[T](String key, T value, Nullable1 expiresIn) in /_/src/Foundatio/Caching/HybridCacheClient.cs:line 146\n at MyWork.Providers.Cache.Redis.BaseCrossTenantsRedisHybridCacheProvider.Set[TItem](String key, TItem value, Nullable1 expirationTime) in /home/runner/work/cloud/cloud/common/MyWORK.Common/Providers/Cache/Redis/BaseCr

gdoron avatar Dec 01 '22 15:12 gdoron

@gdoron I'm not sure what that is but...doesn't appear to be our library?

NickCraver avatar Dec 01 '22 15:12 NickCraver

We are using Foundatio (an amazing library BTW if you are not familiar, I highly recommend checking it) on top of redis stack exchange.

gdoron avatar Dec 01 '22 15:12 gdoron

It is still very hard for us to comment without knowing what's actually going through our library. What value did you supply as expirationTime? in particular, is there any chance it is zero, negative, or very very large? that error comes from the server here, I think from this location (although there are others).

If you're passing a reasonable non-zero, non-negative value, then it becomes more interesting, but since I'm pretty sure we've exercised this path ourselves a lot of times, I would be suspicious that the cause is in the bit we don't know, i.e. Foundatio; in which case: "ask them"?

mgravell avatar Dec 01 '22 16:12 mgravell

I'm dumb. Indeed something in our CI configuration changed that sent expiration time of 0. Sorry for bothering you Marc :( , and you surely helped me find the root cause here <3

gdoron avatar Dec 01 '22 16:12 gdoron