Internal Server Error while browsing

When I browse my site Internal Server Error show!
sudo service mysql status

Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-12-14 21:36:19 UTC; 1min 56s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 1564 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 1573 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1577 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=cd /usr/bin/..; /usr/bin/galera_recovery; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR ||>
Process: 1665 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1667 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Main PID: 1633 (mysqld)
Status: “Taking your SQL requests now…”
Tasks: 32 (limit: 1136)
Memory: 113.0M
CGroup: /system.slice/mariadb.service
└─1633 /usr/sbin/mysqld

Dec 14 21:36:18 Andyyy mysqld[1633]: 2021-12-14 21:36:18 0 [Note] /usr/sbin/mysqld (mysqld 10.3.32-MariaDB-0ubuntu0.20.04.1) starting as process 1633 …
Dec 14 21:36:19 Andyyy systemd[1]: Started MariaDB 10.3.32 database server.
Dec 14 21:36:19 Andyyy /etc/mysql/debian-start[1669]: Upgrading MySQL tables if necessary.
Dec 14 21:36:19 Andyyy /etc/mysql/debian-start[1672]: Looking for ‘mysql’ as: /usr/bin/mysql
Dec 14 21:36:19 Andyyy /etc/mysql/debian-start[1672]: Looking for ‘mysqlcheck’ as: /usr/bin/mysqlcheck
Dec 14 21:36:19 Andyyy /etc/mysql/debian-start[1672]: Version check failed. Got the following error when calling the ‘mysql’ command line client
Dec 14 21:36:19 Andyyy /etc/mysql/debian-start[1672]: ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO)
Dec 14 21:36:19 Andyyy /etc/mysql/debian-start[1672]: FATAL ERROR: Upgrade failed
Dec 14 21:36:19 Andyyy /etc/mysql/debian-start[1682]: Checking for insecure root accounts.
Dec 14 21:36:19 Andyyy debian-start[1685]: ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO)

it was working fine i don’t know what happened! also i can access mysql root …
i tried alot of thing also


but didn’t work.

most common line at logs file
pymysql.err.OperationalError: (2003, “Can’t connect to MySQL server on ‘127.0.0.1’ ([Errno 111] Connection refused)”)


I’m using Ubuntu 20 1 vCPU 1GB Ram

df -h
Filesystem Size Used Avail Use% Mounted on
udev 474M 0 474M 0% /dev
tmpfs 99M 1.2M 97M 2% /run
/dev/vda1 25G 6.2G 18G 26% /
tmpfs 491M 0 491M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 491M 0 491M 0% /sys/fs/cgroup
/dev/loop0 62M 62M 0 100% /snap/core20/1270
/dev/loop2 68M 68M 0 100% /snap/lxd/21835
/dev/loop1 62M 62M 0 100% /snap/core20/1081
/dev/loop3 68M 68M 0 100% /snap/lxd/21545
/dev/loop4 33M 33M 0 100% /snap/snapd/13170
/dev/loop5 44M 44M 0 100% /snap/snapd/14295
/dev/vda15 105M 5.2M 100M 5% /boot/efi
tmpfs 99M 20K 99M 1% /run/user/123
tmpfs 99M 0 99M 0% /run/user/0

free
total used free shared buff/cache available
Mem: 1004844 791052 61356 4392 152436 59968
Swap: 0 0 0

please guide me

also some time gave me this

# 504 Gateway Time-out
nginx/1.18.0 (Ubuntu)

Hi,

One gig of RAM is not going to run ERPNext very well, 2 or more would be better. That being said, if it was working properly at one point and then stopped , was there an update or some other modification performed that preceded the error? What does bench setup nginx and bench build return? does bench mariadb open a session successfully?

Is 1GB RAM cause this error?
Actually I created another site using
bench new-site my.site
I use my new site then the error shows , before that I don’t face any Time-out or ISE. Just slow browsing.
—>

bench setup nginx
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: N

I’m sure about my nginx.conf , after I create new site I generate new config and backup the old one.

bench mariadb
Yes open session successfully.

bench build return :

bench build
Retrieving assets…

:heavy_check_mark: Downloaded Frappe assets from https://github.com/frappe/frappe/releases/download/v13.16.0/assets.tar.gz

Extracting assets…

:heavy_check_mark: Restored js/data_import_tools.min.js
:heavy_check_mark: Restored js/data_import_tools.min.js.map
:heavy_check_mark: Restored js/barcode_scanner.min.js
:heavy_check_mark: Restored js/form.min.js
:heavy_check_mark: Restored js/bootstrap-4-web.min.js
:heavy_check_mark: Restored js/web_form.min.js.map
:heavy_check_mark: Restored js/control.min.js.map
:heavy_check_mark: Restored js/report.min.js
:heavy_check_mark: Restored js/frappe-web.min.js.map
:heavy_check_mark: Restored js/form.min.js.map
:heavy_check_mark: Restored js/chat.js.map
:heavy_check_mark: Restored js/list.min.js
:heavy_check_mark: Restored js/frappe-recorder.min.js
:heavy_check_mark: Restored js/frappe-recorder.min.js.map
:heavy_check_mark: Restored js/dialog.min.js.map
:heavy_check_mark: Restored js/checkout.min.js
:heavy_check_mark: Restored js/desk.min.js
:heavy_check_mark: Restored js/libs.min.js
:heavy_check_mark: Restored js/report.min.js.map
:heavy_check_mark: Restored js/web_form.min.js
:heavy_check_mark: Restored js/dialog.min.js
:heavy_check_mark: Restored js/chat.js
:heavy_check_mark: Restored js/user_profile_controller.min.js
:heavy_check_mark: Restored js/barcode_scanner.min.js.map
:heavy_check_mark: Restored js/bootstrap-4-web.min.js.map
:heavy_check_mark: Restored js/desk.min.js.map
:heavy_check_mark: Restored js/moment-bundle.min.js
:heavy_check_mark: Restored js/user_profile_controller.min.js.map
:heavy_check_mark: Restored js/checkout.min.js.map
:heavy_check_mark: Restored js/frappe-web.min.js
:heavy_check_mark: Restored js/control.min.js
:heavy_check_mark: Restored js/list.min.js.map
:heavy_check_mark: Restored css/printview.css
:heavy_check_mark: Restored css/frappe-web-b4.css
:heavy_check_mark: Restored css/web_form.css
:heavy_check_mark: Restored css/rollup.manifest.css
:heavy_check_mark: Restored css/login.css
:heavy_check_mark: Restored css/report.min.css
:heavy_check_mark: Restored css/email.css
:heavy_check_mark: Restored css/frappe-chat-web.css
:heavy_check_mark: Restored css/desk.min.css
:heavy_check_mark: Restored css-rtl/printview.css
:heavy_check_mark: Restored css-rtl/frappe-web-b4.css
:heavy_check_mark: Restored css-rtl/web_form.css
:heavy_check_mark: Restored css-rtl/login.css
:heavy_check_mark: Restored css-rtl/report.min.css
:heavy_check_mark: Restored css-rtl/email.css
:heavy_check_mark: Restored css-rtl/frappe-chat-web.css
:heavy_check_mark: Restored css-rtl/desk.min.css
Linking /home/roman/frappe-bench/apps/frappe/node_modules to ./assets/frappe/nodLinking /home/roman/frappe-bench/apps/erpnext/node_modules to ./assets/erpnext/n✔ Application Assets Linked

yarn run v1.22.17
$ FRAPPE_ENV=production node rollup/build.js --skip_frappe
Production mode
:heavy_check_mark: Built js/moment-bundle.min.js
:heavy_check_mark: Built js/libs.min.js

Building erpnext assets…

Killed
error Command failed with exit code 137.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Traceback (most recent call last):
File “/usr/lib/python3.8/runpy.py”, line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.8/runpy.py”, line 87, in _run_code
exec(code, run_globals)
File “/home/roman/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 104, in
main()
File “/home/roman/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 19, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/roman/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/roman/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/roman/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/roman/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1259, in invoke
return process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/roman/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/roman/frappe-bench/env/lib/python3.8/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/roman/frappe-bench/apps/frappe/frappe/commands/utils.py”, line 44, in build
frappe.build.bundle(
File “/home/roman/frappe-bench/apps/frappe/frappe/build.py”, line 248, in bundle
frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env(), raise_err=True)
File “/home/roman/frappe-bench/apps/frappe/frappe/commands/init.py”, line 93, in popen
raise subprocess.CalledProcessError(return
, command)
subprocess.CalledProcessError: Command ‘/usr/bin/yarn run production --skip_frappe’ returned non-zero exit status 137.

A quick Google of

non-zero exit status 137

suggests a lack of sufficient memory…