Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EOFError in Server Manager #2907

Open
1 task done
ahankinson opened this issue Jan 23, 2024 · 2 comments
Open
1 task done

EOFError in Server Manager #2907

ahankinson opened this issue Jan 23, 2024 · 2 comments
Labels

Comments

@ahankinson
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have Sentry monitoring my Sanic server processes. Increasingly, I am seeing EOFError exceptions. A minimal stack trace is this:

EOFError: null
  File "sanic/mixins/startup.py", line 1146, in serve
    manager.run()
  File "sanic/worker/manager.py", line 189, in run
    self.monitor()
  File "sanic/worker/manager.py", line 294, in monitor
    self._sync_states()
  File "sanic/worker/manager.py", line 427, in _sync_states
    state = self.worker_state[process.name].get("state")
  File "<string>", line 2, in __getitem__
  File "multiprocessing/managers.py", line 822, in _callmethod
    kind, result = conn.recv()
  File "multiprocessing/connection.py", line 254, in recv
    buf = self._recv_bytes()
  File "multiprocessing/connection.py", line 418, in _recv_bytes
    buf = self._recv(4)
  File "multiprocessing/connection.py", line 387, in _recv
    raise EOFError

I am running Sanic with the following command (formatted as a python list):

[
/path/to/.venv/bin/sanic, 
module_name.server.app, 
--host, 
[my::IP::v6::address], 
--port, 
8003, 
--fast, 
--no-access-logs
]

This is run through a systemd unit file:

[Unit]
Description=My Description

[Service]
User=svc-user
Group=svc-user
Restart=always
RestartSec=5
TimeoutSec=5
WorkingDirectory=/path/to/application/
ExecStart=/path/to/application/.venv/bin/sanic module_name.server.app --host [my::IP::v6::address] --port 8003 --fast --no-access-logs

[Install]
WantedBy=multi-user.target

I'm attaching a PDF of the full stack trace that Sentry is reporting. I apologize that it's not in a more convenient form, but I couldn't figure out how to get it out in a readable manner.
stack-trace.pdf

Code snippet

There does not seem to be any interaction with my own application code.

Expected Behavior

No response

How do you run Sanic?

Sanic CLI

Operating System

Linux

Sanic Version

23.12.1

Additional context

Ubuntu 22.04 (Linux-5.15.0-89-generic-x86_64-with-glibc2.35)

Python 3.11.0

@ahankinson ahankinson added the bug label Jan 23, 2024
@ahopkins
Copy link
Member

ahopkins commented Jan 23, 2024

Any way I can reproduce this?

@ahankinson
Copy link
Author

Unfortunately I'm not getting any information about any requests that are triggering this, other than what is in the stack trace.

My current working hypothesis is that it's a client that prematurely closes the request. The only other clue is that sometimes it's failing with the buf variable being something like:

b'\x00\x00\x00*\x80\x04\x95\x1f\x00\x00\x00\x00\x00\x00\x00(\x8c\x0c7f7c1afd5f40\x94\x8c\x06values\x94)}\x94t\x94.'

I don't know how to decode it, nor do I know if it's useful if I did. It is never the same value, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants