R
RunPod•2mo ago
vitalik

Pod stuck when starting container

Yesterday I updated my serverless endpoint with "New release" button. However when the new request came the worker stuck when trying to start container and sucked the remaining funds from my account. In the logs I see multiple worker exited with exit code 0 errors Probably something wrong with my container, but would be nice if after multiple failed attempts to start container the worker stopped automatically and didn't drain money.
11 Replies
nerdylive
nerdylive•2mo ago
maybe its on your program ( not sure ) how does your handler file looks like, or describe how it works maybe
Encyrption
Encyrption•2mo ago
Returning 0 is reporting success. If you want it to count as a failure it will need to return a number other than 0. Suggest you open a ticket with RunPod (under help/contact on their site) they are generally pretty good about those kinds of things.
vitalik
vitalikOP•2mo ago
It is just starting ComfyUI and executing prompts from incoming requests if __name__ == "__main__": wait_for_service(url="http://{}/prompt".format(COMFYUI_ADDRESS)) print("ComfyUI is ready. Starting RunPod...") runpod.serverless.start({"handler": handler}) Ok, thanks. The weird part is that it kept trying to execute single request for many hours, logs look like this 2024-10-09 06:55:45.855[n5bwvtgs4p6x3t][error]worker exited with exit code 0 2024-10-09 06:55:29.577[n5bwvtgs4p6x3t][error]worker exited with exit code 0 2024-10-09 06:55:13.271[n5bwvtgs4p6x3t][error]worker exited with exit code 0 ... and so on
Encyrption
Encyrption•2mo ago
I think I see the problem, You should NOT be querying ComfyUI in main. That should happen in your handler function. In main this is before you have any request. Does your handler function have similar code or does your handler function call another function with similar code as below?
# The top level element "prompt" is required by ComfyUI
data = json.dumps({"prompt": workflow}).encode("utf-8")

req = urllib.request.Request(f"http://{COMFY_HOST}/prompt", data=data)
# The top level element "prompt" is required by ComfyUI
data = json.dumps({"prompt": workflow}).encode("utf-8")

req = urllib.request.Request(f"http://{COMFY_HOST}/prompt", data=data)
vitalik
vitalikOP•2mo ago
yes, it has exact same code and some other stuff like uploading generated images to s3
Encyrption
Encyrption•2mo ago
GitHub
GitHub - blib-la/runpod-worker-comfy: ComfyUI as a serverless API o...
ComfyUI as a serverless API on RunPod. Contribute to blib-la/runpod-worker-comfy development by creating an account on GitHub.
Encyrption
Encyrption•2mo ago
I use that one and this is my complete main:
# Start the handler only if this script is run directly
if __name__ == "__main__":
runpod.serverless.start({"handler": handler})
# Start the handler only if this script is run directly
if __name__ == "__main__":
runpod.serverless.start({"handler": handler})
vitalik
vitalikOP•2mo ago
nice, i'll have a look at it, thank you
Encyrption
Encyrption•2mo ago
wait... that is for Serverless Worker, not pod.
vitalik
vitalikOP•2mo ago
yes, i'm using serverless
Encyrption
Encyrption•2mo ago
🙂 oh ok yeah then that shold work for you
Want results from more Discord servers?
Add your server