Possible data corruption with memcached
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
調査の方向性
identity_cache/encoder.rb:71 から始め、cached/primary_index.rb と cache_key_loader.rb を通るデコード経路を追跡してください。記載されている Rails、identity_cache、Dalli、Memcached のバージョンを使用して、モデルクラスのデプロイ前後でキャッシュされた値と動作を比較してください。破損の原因が特定され、報告されているデコードエラーなしで影響を受けたデプロイまたはキャッシュ動作を検証できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi!
First of all thanks for the great work on this gem.
Here's my situation/scenario: I'm deploying a Rails 7 app to AWS and using Elasticache Memcached as the store for Identity cache, rails cache and cache store.
The app runs as expected, users are able to access, the data is cached into memcached and I can see the usage metrics (bytes read/write, conn numbers, cpu, unused memory, etc)
After some time, the app started raising a lot of exceptions and users were no longer able to access it.
The app was barely used (testing infrastructure), and memcached metrics/health looks ok (lots of spare resources).
Some examples of exceptions:
Dalli::UnmarshalError: Unable to unmarshal value: marshal data too shortDalli::DalliError: Response error: "?x??UOk$E7*?Dalli::DalliError: Response error: VADalli::DalliError: Response error: NSDalli::DalliError: Response error: ".\u0000[:idc_cached_nilf1670773635.8781602
Cleaning the memcached data fixed the issue, but it happened again the next day.
What could be causing this? I've double checked configs everywhere (sample below) and no clue so far on what could be causing it. I'm moving the data from identity cache to an isolated memcached instance.
Any clues? Thoughts?
Thank you!
gems:
dalli (3.2.3)
identity_cache (1.2.0)
rails (7.0.4)
memcached version 1.6.17 (docker version running on CI) and on AWS Elasticache (1.6.16)
app configs:
config.session_store :cache_store,
key: "the_session_key",
expire_after: 24.hours
config.cache_store = :mem_cache_store, "memcached.server.url",
{ pool: { size: 30 }, protocol: :meta, expires_in: 24.hours,
failover: false } # avoids more cache consistency issues
config.action_policy.cache_store = :mem_cache_store, "memcached.server.url",
{ pool: { size: 30 }, protocol: :meta, expires_in: 1.hour,
failover: false } # avoids more cache consistency issues
config.identity_cache_store = :mem_cache_store, "memcached.server.url",
{ pool: { size: 30 }, protocol: :meta, expires_in: 6.hours,
failover: false } # avoids more cache consistency issues
Update 1:
Issues happen when updating the model classes and doing a new deploy.
Example stack trace
Error message:
no implicit conversion of Symbol into Integer
…r/bundle/ruby/3.1.0/gems/identity_cache-1.2.0/lib/identity_cache/encoder.rb:71:in `[]'
…r/bundle/ruby/3.1.0/gems/identity_cache-1.2.0/lib/identity_cache/encoder.rb:71:in `record_from_coder'
…r/bundle/ruby/3.1.0/gems/identity_cache-1.2.0/lib/identity_cache/encoder.rb:21:in `block in decode'
…dle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/notifications.rb:208:in `instrument'
…r/bundle/ruby/3.1.0/gems/identity_cache-1.2.0/lib/identity_cache/encoder.rb:20:in `decode'
…/3.1.0/gems/identity_cache-1.2.0/lib/identity_cache/cached/primary_index.rb:74:in `cache_decode'
…ruby/3.1.0/gems/identity_cache-1.2.0/lib/identity_cache/cache_key_loader.rb:38:in `load'
…/3.1.0/gems/identity_cache-1.2.0/lib/identity_cache/cached/primary_index.rb:17:in `fetch'
…by/3.1.0/gems/identity_cache-1.2.0/lib/identity_cache/with_primary_index.rb:127:in `fetch_by_id'
…by/3.1.0/gems/identity_cache-1.2.0/lib/identity_cache/with_primary_index.rb:67:in `fetch_by_slug'
- 主要言語
- Ruby
- スター
- 2k
- フォーク
- 175
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Shopify/identity_cache のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
Shopify/identity_cache#568 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
Shopify/identity_cache#555 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Shopify/identity_cache#539 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
Shopify/identity_cache#535 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
Shopify/identity_cache#533 · コメント 1 件 ·
Shopify/identity_cache の issue をすべて見る
似ている issue
-
bug priority: high
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
mitakarb/beerkeeper#1259 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
agent:triaged bug bughunt pm:bundler priority:p1
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
SocketDev/socket-patch#1125 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
ecosyste-ms/funds#711 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
cloudflare/mcp#271 ·
メンテナーはふだん 1 日以内に返信