Skip to content

Version 1.1.1 is possibly not working for old keys? (need confirmation) #183

@vantheshark

Description

@vantheshark

Hi,

We've updated from 0.8.0 to 1.1.1 and found many issues, unfortunately on our Production >.<
CacheManager.Core
CacheManager.StackExchange.Redis

"# Server
redis_version:3.0.7
redis_build_id:f7cfd70bacad9a98
redis_mode:cluster
os:Linux 3.10.0-327.13.1.el7.x86_64 x86_64
gcc_version:4.8.5

1/ There are suddenly a lot of errors: Update failed on ':' because of too many retries. There are many old key created by previous version but when running with the version 1.1.1, the problem seems to start to occur and the old key staying there undeleted/unexpired.

More info
The hashvalue of the key (probably created by the old version)
HasValue

The code that read the key probably check the expiration mode incorrectly, please confirm
Code version 1.1.1

When comparing the version, it's getting obvious that my theory is correct 😠

Breaking change

usesDefaultExpiration is true in this case however, the expirationMode was sliding as created by the old version. I think the cacheItem creation should use the existing expirationMode unless it's "None" and usesDefaultExpiration == true.

// Current code
var cacheItem =
	usesDefaultExpiration ?
	string.IsNullOrWhiteSpace(region) ?
		new CacheItem<TCacheValue>(key, value) :
		new CacheItem<TCacheValue>(key, region, value) :
	string.IsNullOrWhiteSpace(region) ?
		new CacheItem<TCacheValue>(key, value, expirationMode, expirationTimeout) :
		new CacheItem<TCacheValue>(key, region, value, expirationMode, expirationTimeout);

Finally, i saw the code EvictFromOtherHandles if the version is conflicted but for some reasons the key is not deleted from the other Handle.

2/ OutOfMemoryException thrown From BackplaneMessage.ReadBytes

OutOfMemoryException

And it came from here
DeserializeMessage

I tried to debug but I'm not really familiar with the code so it might be better for the author to have a look.

Rollback to 0.8.0 and the problem gone.
Thanks

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions