0
0

メモリ不足で?AWS EC2 linux2+MATE環境のchromiumでwebサイトが見られなかった件

Posted at

まず結論

t2.nanoではなく、t2.microを使用すると解決した。

はじめに

EC2 linux2にMATEでデスクトップ環境を構築しましたが、そのインスタンスにRDP接続しChromiumでwebページを表示しようとしたところ、Error code 5となって目的のページは表示されませんでした。

問題

EC2のアウトバウンドルールで全てのプロトコルを、IPを0.0.0.0/0を許可しています。EC2検索候補の表示はされるので、webとの通信は問題なさそうです。

問題は、chromiumでwebページを表示させようとした場合にError code 5が出力され、目的のページが表示されません。

image.png

image.png

また、ssh経由でchrome headlessモードで特定のページのスクリーンショットを撮ろうとしても、Failed to reserve virtual memeory for CodeRangeとなりました。(そのままですが。)

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ google-chrome --headless --screenshot --window-size=1280,1000 https://qiita.com/
[0707/013044.311024:WARNING:sandbox_linux.cc(430)] InitializeSandbox() called with multiple threads in process gpu-process.
[0707/013045.023361:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
[0707/013045.111257:ERROR:v8_initializer.cc(809)] V8 process OOM (Failed to reserve virtual memory for CodeRange).
[0707/013045.164549:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0707/013045.164702:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[0707/013045.167388:ERROR:directory_reader_posix.cc(43)] opendir /tmp/Crashpad/attachments/1825df44-52da-44ea-a1f9-132f48cdb934: No such file or directory (2)
[0707/013045.924564:ERROR:http_transport_libcurl.cc(485)] HTTP status 429

原因と解決

headlessモードのエラー原因は、Error出力そのまま、メモリ不足。
t2.nanoで起動していたインスタンスを一度停止し、t2.microに変更し起動したところ、googleページを無事見ることができました。

image.png

また、ssh接続からheadlessモードで実施したスクリーンショットも無事取得することができました。

[ec2-user@ip-XXX-XXX-XXX-XXX ~]$ google-chrome --headless --screenshot --window-size=1280,1000 https://qiita.com/
[0707/150010.610467:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
[0707/150010.776913:WARNING:sandbox_linux.cc(430)] InitializeSandbox() called with multiple threads in process gpu-process.
337029 bytes written to file screenshot.png

まとめ

グラフィック処理となった場合は、t2.nanoでは厳しいようです。

ちなみに、t2.microでも、RDP接続したままでssh接続からheadlessモードでスクリーンショットを撮ろうとするとメモリ不足でダメでした。

0
0
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
0
0