1
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.

Webで突然メモリオーバーした場合の調査方法

Last updated at Posted at 2019-09-21

突然サービスでエラーが出始めた

とりあえずログを見る

メモリオーバーでエラーが出ている

[21-Sep-2019 04:30:40] PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 71 bytes) in /var/www/xxxxRedisUtil.php on line 60
[21-Sep-2019 04:34:42] PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 6 bytes) in /var/www/xxxxDaoUtil.php on line 314
  • データストアのUtilクラスでメモリオーバーしているのは把握できたが、どのページか判断できない

アクセスログで500エラーを探せばだいたい見つかる

[root@xxxWeb01 ~]# cat /var/log/httpd/xxxx.com.access_log.20190920 | grep " 500 "
100.100.xxx.17 - - [20/Sep/2019:00:00:01 +0900] "GET /xxxxx HTTP/1.1" 500 20 "-" "Mozilla/5.0 (Linux; Android 7.0; WAS-LX2J Build/HUAWEIWAS-LX2J; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.132 Mobile Safari/537.36 Sleipnir/3.5.16" "-" "-" "-" 1590957 "-" "-" "64" "/xxxx/" "1684366134" "-" "-"
100.100.xxx.19 - - [20/Sep/2019:00:10:02 +0900] "POST /xxxx HTTP/1.1" 500 20 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1" "-" "-" "-" 2221272 "-" "-" "32" "/xxxxx" "1667523941" "-" "-"
100.100.xxx.40 - - [20/Sep/2019:02:10:01 +0900] "GET /xxxx HTTP/1.1" 500 20 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Mobile/15E148 Safari/604.1" "-" "-" "-" 803358 "-" "-" "32" "/xxxx" "1697658468" "-" "-"

あとは対応するだけ

  • ini_setでメモリ増やすなり
  • リファクタしてメモリ消費をへらすなり
1
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
1
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?