Site Crashes Intermittently

Hello,

Over the last few weeks, i noticed that my site crashes intermittently without any back-end processes being carried out. i checked my web.error.log and every other logs in bench and they came up empty. The only way to get my instance up is to reboot the machine. I even backed up my site, reinstalled my server from scratch and restored my backup to the new installation but the issue still won’t go away.

I did a bit of research and a query directed me to the frappe log. This is what i found:

[ERROR] 2017-10-06 07:34:44,678 | /home/frappe/frappe-bench/apps/frappe/frappe/$
Site: site1.local
Request Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 54, in appli$
init_request(request)
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 116, in init$
frappe.local.http_request = frappe.auth.HTTPRequest()
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 53, in __in$
frappe.local.login_manager = LoginManager()
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 116, in __i$
self.set_user_info(resume=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 145, in set$
[“user_type”, “first_name”, “last_name”, “user_image”], as_dict=1)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 429, in$
order_by, cache=cache)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 473, in$
out = self._get_values_from_table(fields, filters, doctype, as_dict, debug,$
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 605, in$
as_dict=as_dict, debug=debug, update=update)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 123, in$
self.connect()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 69, in $
use_unicode=True, charset=‘utf8mb4’)
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb$
return Connection(*args, **kwargs)
File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb$
super(Connection, self).init(*args, **kwargs2)
OperationalError: (2002, 'Can’t connect to local MySQL server through socket $

The error timelines are pretty consistent with the times my website goes down and gives the internal server error. Can anyone point me to how i can resolve this?

Mysql service is down. Check mysql-error.logs

It appears you are low on ram…I have solved such issue by increasing swap memory…Let me know if it works for you

2 Likes

Try using a 1-2 GB ram at least it solved it for me, especially on DigitalOcean

1 Like

Hello all, based on the responses so far, the general consensus is that the RAM is low. My instance is running on an Amazon EC2 Cloud server and its on the free tier. I guess it doesn’t offer much by way of memory but i can’t figure out the way to determine how much RAM i have allocated or how much the instance uses. I am moving my instance to google cloud where i know i have 3.75GB RAM and 10GB storage. I will watch out for these errors after the migration

To check how much ram is available in your EC2 instance, use the top command in a terminal window. See below screenshot.
Capture

Kib Mem is the allocated ram. Kib Swap is the disk swap. For the EC2 instance, by default, the swap would be at 0.

It is definitely a low memory issue. Experienced this before and fixed it by setting a 2 gb swap disk.

Regards.

1 Like

Thanks everyone for being a great help. indeed it was a memory issue and i seem to have resolved it by creating a swap disk as suggested by @H_N. i don’t know how this will affect my actual storage but fingers crossed that this will stop further heartaches. Thanks once again.