Server Error (BrokenPipeError: [Errno 32] Broken pipe)

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 there a solution to this error? I am encountering it as well after my session stayed open for long

For temporary solution, you can clear your browser’s cache, it will work fine, but I could not find out the best solution yet.

@usopheak Why the session is idle ?

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

For me. I take a backup from my current server and make new server and restore it again that’s working with me

1 Like

I’m doing a bench destroy-all-sessions but I have to do almost every day. It needs permanent fixing

This is a network infrastructure problem; only your local providers can help you identify and remedy your particular case.

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.

1 Like

@Clement_Uwajeneza1 Can you please let me know, which are the scheduled jobs and how to identify it?

1 Like

hello,

I am also facing same issue, do you get the solution.

how to make sure the scheduled jobs are running?

and if not then what to do?

1 Like

Hello Everyone,

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.

  1. Run bench --site [sitename] enable-scheduler
    And you will see this message, Enabled for staging.com

  2. 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

Thank You ALL

1 Like