Is there a timeout (max runtime) for spaces?
I’ve been trying to make a 3d photo inpainting project work on huggingface spaces. After finally getting PyQt5 working with a headless display (lots of fun debugging viasubprocesscalls via python inapp.py, since we don’t have access to the shell 0.0), it turns out spaces automatically timesout at around ~60 seconds?The documentation said to useenable_queue=Truein theiface.launch(enable_queue=True)function for gradio, but this doesn’t seem to help. Does HF Spaces automatically drop requests that span longer than 60 seconds? (the gradio timer on the spaces page counts up to 60, then prints error afterwards).Checking the logs does show that the inference is able to finish running, but won’t be able to return anything back to the front-end via gradio since the connection gets cut.Spaces currently set to private, but if any HF devs want to take a look & have access to private instances, here’s the link3D_Photo_Inpainting - a Hugging Face Space by ClassifiedError on request:
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/werkzeug/serving.py", line 319, in run_wsgi
    execute(self.server.app)
  File "/home/user/.local/lib/python3.8/site-packages/werkzeug/serving.py", line 311, in execute
    write(data)
  File "/home/user/.local/lib/python3.8/site-packages/werkzeug/serving.py", line 290, in write
    self.wfile.write(data)
  File "/usr/local/lib/python3.8/socketserver.py", line 826, in write
    self._sock.sendall(b)
TimeoutError: [Errno 110] Connection timed out
2021-12-21T02:03:41Z
Update: Making a simple app.py:Input an imagesleep for 70 secondsOutput the same imageThis results in the same thing (timing out after 60 seconds)When changing the sleep to 50 seconds, it’s able to return the image.
2021-12-21T02:26:03Z
Update 2 / Solution:So turns out usingenable_queue=Trueinlaunch()doesn’t work, e.g:iface = gr.Interface(fn=..., inputs=..., outputs=...)
iface.launch(enable_queue=True)After looking at the source code, I saw thatenable_queueis a deprecated argument inInference()Doing the following fixed the 60 second timeout for me:iface = gr.Interface(fn=..., inputs=..., outputs=..., enable_queue=True)
iface.launch()
2021-12-21T08:28:29Z
Hi@Epoching. Glad you were able to fix it!Moving forward, we plan to setenable_queue=Truefor all spaces by default.cc@cbensimon
2021-12-21T18:28:51Z
I second this, would be a great feature!
2021-12-22T13:54:23Z
I’m glad you were able to make it work,@Epoching! I’m one of the developers of@Gradioand if you have any other feedback (in addition to what you’ve described above, which we’ll fix by enabling queue by default in Spaces), let me know!
2022-03-31T00:00:09Z
Thanks for the tip.  This got me unstuck as well!