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

Fix OSError in Vercel Serverless Functions deployment #149

Open
taesungh opened this issue Dec 18, 2023 · 4 comments
Open

Fix OSError in Vercel Serverless Functions deployment #149

taesungh opened this issue Dec 18, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@taesungh
Copy link
Member

taesungh commented Dec 18, 2023

Similar to HackAtUCI/HackUCI-Site#86
The API sporadically encounters a runtime issue causing requests to fail

[ERROR] OSError: [Errno 24] Too many open files
Traceback (most recent call last):
  File "/var/task/vc__handler__python.py", line 305, in vc_handler
    response = asgi_cycle(__vc_module.app, body)
  File "/var/task/vc__handler__python.py", line 201, in __call__
    loop = asyncio.new_event_loop()
  File "/var/lang/lib/python3.9/asyncio/events.py", line 761, in new_event_loop
    return get_event_loop_policy().new_event_loop()
  File "/var/lang/lib/python3.9/asyncio/events.py", line 659, in new_event_loop
    return self._loop_factory()
  File "/var/lang/lib/python3.9/asyncio/unix_events.py", line 54, in __init__
    super().__init__(selector)
  File "/var/lang/lib/python3.9/asyncio/selector_events.py", line 53, in __init__
    selector = selectors.DefaultSelector()
  File "/var/lang/lib/python3.9/selectors.py", line 350, in __init__
    self._selector = self._selector_cls()

where vc__handler__python.py refers to Vercel's Python runtime handler.

@taesungh taesungh added the bug Something isn't working label Dec 18, 2023
@taesungh
Copy link
Member Author

Submitted Kludex/mangum#315 to ask if they have any thoughts.

@samderanova
Copy link
Contributor

We might be able to set up a Vercel CRON job to automatically redeploy at a certain interval. Currently investigating this.

@taesungh
Copy link
Member Author

Deployed temporary AWS Lambda function which runs periodically to check Axiom logs and redeploy last Vercel deployment when needed.

@taesungh
Copy link
Member Author

It seems that while Vercel added support for Python 3.12 (including ASGI) via vercel/vercel#11675, the logic for ASGICycle in vc_init.py was updated to fit with the changes in Python 3.10

The loop parameter has been removed from most of asyncio‘s high-level API following deprecation in Python 3.8.

Perhaps upgrading to Python 3.12 on Vercel will fix the OSError issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants