2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHP Warning: Unknown: Unable to clear session lock record in

Posted at

HTTPのセッションをmemcachedでメモリ管理したいのだが・・・

環境

  • Apache 2.4.23
  • php 7.0.13
  • memcached 1.4.33 (ElastiCache)

症状

sessionへのアクセス時にエラーになり、$_SESSIONが使えない

session.lazy_write = Off
を設定すると少し動作が改善されて数回に1回の割合で$_SESSIONへのアクセスがエラーになる。

memcached.sess_lock_wait_min = 250
を設定すると、さらに安定するが、数十回に1回ぐらいの割合で$_SESSIONへのアクセスがエラーになる。

workaround

memcached をやめて、redis に変更(php?のバージョンアップで改善されると思われるので・・・)。
https://pecl.php.net/package/redis/3.1.1 このあたりからモジュールをインストール

[Session] session.save_handler = redis session.save_path = "aws-XXXXX-XXXXX.XXXXX.XXXXX.cache.amazonaws.com:6379"

この設定だけで、動作確認OK。

AWSなので、memcached/redisどちらを使ってもコストは一緒。
最終的に、redisのクラスタ構成で安定稼働を目指します。

2017-03-19 17_46_04-phpinfo().png

参考:
https://github.com/magento/magento2/issues/5319
https://forums.aws.amazon.com/thread.jspa?threadID=240538

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?