Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis: RedisScript (LuaScript) execution error - CultureInfo problem #162

Closed
bsr-ky opened this issue Feb 28, 2023 · 7 comments
Closed

Redis: RedisScript (LuaScript) execution error - CultureInfo problem #162

bsr-ky opened this issue Feb 28, 2023 · 7 comments
Labels
dependencies Pull requests that update a dependency file redis
Milestone

Comments

@bsr-ky
Copy link

bsr-ky commented Feb 28, 2023

There is a CultureInfo problem when executing RedisScript (LuaScript). For CulturerInfo "tr-TR", a parameter named "@lockid" cannot be found in script text when disposing lock.

Reason:
The cause of issue is culture dependent regex named as ParameterExtractor at StackExchange.Redis. The issue (StackExchange/StackExchange.Redis#2350) is fixed at version 2.6.96 (https://stackexchange.github.io/StackExchange.Redis/ReleaseNotes).

Solution:
Version of StackExchange.Redis should be upgraded from 2.2.4 to 2.6.96.

Error Stack Trace:

System.ArgumentException: ps (Parameter 'Expected [lock] to be a field or gettable property on [<>f__AnonymousType02[[StackExchange.Redis.RedisKey, StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46],[StackExchange.Redis.RedisValue, StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46]]]') at StackExchange.Redis.LuaScript.ExtractParameters(Object ps, Nullable1 keyPrefix, RedisKey[]& keys, RedisValue[]& args) in //src/StackExchange.Redis/LuaScript.cs:line 117
at StackExchange.Redis.LuaScript.Evaluate(IDatabase db, Object ps, Nullable1 withKeyPrefix, CommandFlags flags) in /_/src/StackExchange.Redis/LuaScript.cs:line 148 at StackExchange.Redis.RedisDatabase.ScriptEvaluate(LuaScript script, Object parameters, CommandFlags flags) in /_/src/StackExchange.Redis/RedisDatabase.cs:line 1223 at Medallion.Threading.Redis.Primitives.RedisScript1.Execute(IDatabase database, TArgument argument, Boolean fireAndForget) in /
/DistributedLock.Redis/Primitives/RedisScript.cs:line 25
at Medallion.Threading.Redis.Primitives.RedisMutexPrimitive.Release(IDatabase database, Boolean fireAndForget) in //DistributedLock.Redis/Primitives/RedisMutexPrimitive.cs:line 35
at Medallion.Threading.Redis.RedLock.RedLockRelease.ReleaseAsync() in /
/DistributedLock.Redis/RedLock/RedLockRelease.cs:line 68
--- End of inner exception stack trace ---
at Medallion.Threading.Redis.RedLock.RedLockRelease.ReleaseAsync() in //DistributedLock.Redis/RedLock/RedLockRelease.cs:line 78
at Medallion.Threading.Redis.RedLock.RedLockHandle.DisposeAsync() in /
/DistributedLock.Redis/RedLock/RedLockHandle.cs:line 52
at Medallion.Threading.Internal.SyncViaAsync.<>c__3`1.<b__3_0>d.MoveNext() in /_/DistributedLock.Core/Internal/SyncViaAsync.cs:line 35

@madelson
Copy link
Owner

madelson commented Mar 1, 2023

Thanks for reporting @bsr-ky ! I will include the upgraded version in the next release.

In the meantime, can you confirm that you can resolve this issue by adding a PackageReference to the higher version in your project?

@madelson madelson added the dependencies Pull requests that update a dependency file label Mar 1, 2023
@madelson madelson modified the milestone: 2.3.2 Mar 1, 2023
@bsr-ky
Copy link
Author

bsr-ky commented Mar 1, 2023

Yes, I can confirm. I wrote a simple unit test for validation but could not push to a remote branch in this repository because of permission error.

@madelson
Copy link
Owner

I wrote a simple unit test for validation but could not push to a remote branch in this repository because of permission error.

To make a PR, you should be able to fork this repo, push the change to a branch in your fork, and then make a PR back to my repo. I'd love to take a look at it.

@madelson
Copy link
Owner

I tried updating to both this version and the latest version (2.6.122); I'm seeing some test failures. I'll need to investigate further.

@jrgcubano
Copy link

Hello @madelson. Any news in this regard? Thanks in advance!

@madelson
Copy link
Owner

madelson commented Sep 1, 2023

@jrgcubano is the workaround of just upgrading stackexchange.redis yourself not working for you?

I do intend to get to this, but haven’t had time recently. My impression is that no one is blocked and so this is more of an inconvenience.

@jrgcubano
Copy link

@madelson Sorry for the delay in answering.

I interpreted the issue incorrectly. Everything works perfectly and the upgrade too.

Thanks a lot for this library.

Bartleby2718 added a commit to Bartleby2718/DistributedLock that referenced this issue Oct 2, 2023
… BacklogPolicy.FailFast for backward compatibility)
@madelson madelson added this to the 2.4 milestone Feb 24, 2024
@madelson madelson added the redis label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file redis
Projects
None yet
Development

No branches or pull requests

3 participants