When I keep my session idle over night and open it in the next morning, it appear as server error, unless I clear my browser cache. How can i resolve and prevent this problem?
Server Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 52, in application
init_request(request)
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 117, in init_request
frappe.local.http_request = frappe.auth.HTTPRequest()
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 51, in init
frappe.local.login_manager = LoginManager()
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 113, in init
self.make_session(resume=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/auth.py”, line 188, in make_session
full_name=self.full_name, user_type=self.user_type)
File “/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py”, line 194, in init
self.resume()
File “/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py”, line 255, in resume
data = self.get_session_record()
File “/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py”, line 273, in get_session_record
r = self.get_session_data()
File “/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py”, line 287, in get_session_data
data = self.get_session_data_from_cache()
File “/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py”, line 304, in get_session_data_from_cache
print(‘deleting…’)
BrokenPipeError: [Errno 32] Broken pipe
Is it development environment ? If yes then you have to kill the process of the frappe, node, redis, and have to start bench.
But, if you are using development environment as production environment i.e using bench start in virtual machine (VM). Then you have to do setup for the production using nginx and supervisord
Actually ended up noticing that on the server where I had this issue, Scheduled jobs weren’t running. Which means the clear-expired-sessions job wasn’t being executed, leading to the Brokenpipe error on sessions.py
FIX = Make sure the scheduled jobs are running.
To run the scheduled jobs run this command: 1. bench --site [sitename] doctor
-----Checking scheduler status-----
staging.com: SystemSettings.enable_scheduler is UNSET
Scheduler disabled for techxcel-staging.com
staging.com: SystemSettings.enable_scheduler is UNSET
Scheduler inactive for staging.com
Workers online: 8
-----staging.com Jobs-----
It means we have to enable scheduler.
Run bench --site [sitename] enable-scheduler
And you will see this message, Enabled for staging.com
And final if still not solved then run bench --site [sitename] restart
or again try to start the bench bench start
Other things you can check:
Persistent Scheduler Pausing
Check if there is a setting or script that automatically pauses the scheduler. Look into site_config.json and common_site_config.json for any scheduler-related settings. { "pause_scheduler": 0 }
Scheduler Configuration
Pause/Resume Scheduler:
Ensure the scheduler is properly configured and not paused. You mentioned the scheduler is paused; you can unpause it. bench --site [sitename] scheduler resume