Internal Server Error - every 2 hours

Hi,

We just migrated one of our clients to AWS, but we are facing this problem of Internal Server Error again and again. Once this error comes up, nothing seems to work in the background. When we run

sudo service mysql restart

getting this following error,

"Job for mariadb.service failed because the control process exited with error code. See “systemctl status mariadb.service” and “journalctl -xe” for details.

Then, we run

sudo shutdown -r 0 now
sudo service supervisor restart
sudo service nginx restart

Only after restarting the server and services, the site is accessible again. Can you please assist in letting us know why this problem is recurring every 2 hours or so.

Thanks
Uma

1 Like

This is the error showing inside the web.error.log

[ERROR] Error handling request /api/method/frappe.async.can_subscribe_doc?sid=860b6f0eddec63a389687c5d24fa0744c7183f66b4660fc2eab98d20&doctype=Purchase%20Receipt&docname=PREC%2FU1%2F16-17%2F01208

OperationalError: (2002, ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111 “Connection refused”)’)

See your memory, see slow query log

Hi @rushabh,

Where do i find this log? I couldn’t find it under /var/log/mysql.

Regards
Uma

This is the error showing in frappe.log:

New Exception collected with id: 2017-01-24 10:00:23.867631-117.198.96.5-d16
[ERROR] 2017-01-24 10:00:25,351 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py:
Site: site1.local
Exception in Enqueue Events for Site site1.local
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 64, in enqueue_events_for_site
if is_scheduler_disabled():
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/scheduler.py”, line 214, in is_scheduler_disabled
return not frappe.utils.cint(frappe.db.get_single_value(“System Settings”, “enable_scheduler”))
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 550, in get_single_value
tabSingles where doctype=%s and field=%s""", (doctype, fieldname))
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 106, in sql
self.connect()
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 52, in connect
use_unicode=True, charset=‘utf8’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/init.py”, line 81, in Connect
return Connection(*args, **kwargs)

File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 193, in init
super(Connection, self).init(*args, **kwargs2)
OperationalError: (2002, ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (111 “Connection refused”)’)

I face same problem but not like you, It happen every 2 or 3 days!
I solve it by adding swap.

Check this link:

How To Add Swap on Ubuntu 14.04

Thanks for the replies @Mohammed_Redha and @rushabh_mehta :slight_smile:

We were able to increase the swap space. The server seems to be working fine right now. We will be monitoring it for 2 more days.

Thanks
Uma