cdfmlr / muvtuber

Makes your AI vtuber
445 stars 75 forks source link

[muvtuberdriver] DeadlineExceeded #52

Open ilNikk opened 1 year ago

ilNikk commented 1 year ago

Hi! I often encounter this error and I have to restart the container to get everything working again

muvtuberdriver-1     | 2023/06/24 17:44:18 INFO [chatbot] SessionClient Chat: got textIn: chatbotName=ChatGPTChatbot textin=misa...yan?
muvtuberdriver-1     | 2023/06/24 17:45:18 WARN [chatbot] ChatGPTChatbot Chat() failed. The SessionClient will be released if successive failures: serAddr=chatgpt_chatbot:50052 failures=2/3 err=Chat(addr=chatgpt_chatbot:50052) failed: rpc error: code = DeadlineExceeded desc = Deadline Exceeded
muvtuberdriver-1     | 2023/06/24 17:45:18 ERROR [PrioritizedChatbot] all Chatbots failed: Chat() failed. The SessionClient will be released if successive failures: serAddr=chatgpt_chatbot:50052 failures=2/3 err=Chat(addr=chatgpt_chatbot:50052) failed: rpc error: code = DeadlineExceeded desc = Deadline Exceeded, return nil
muvtuberdriver-1     | 2023/06/24 17:45:18 ERROR chatbot.Chat(&{user test 2}) failed: Chat() failed. The SessionClient will be released if successive failures: serAddr=chatgpt_chatbot:50052 failures=2/3 err=Chat(addr=chatgpt_chatbot:50052) failed: rpc error: code = DeadlineExceeded desc = Deadline Exceeded

Any Idea?

cdfmlr commented 1 year ago

There is a timeout for the ChatGPT call. Defined at muvtuberdriver/chatbot/grpccli.go#L22-L46:

const DefaultRPCTimeout = time.Second * 60

// Client is a gRPC client for the ChatbotService
type Client struct {
    conn   *grpc.ClientConn
    client chatbotv2.ChatbotServiceClient

    RPCTimeout time.Duration

    pool.Poolable
}

// NewClient creates a new Client
func NewClient(addr string) (*Client, error) {
    conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
    if err != nil {
        return nil, err
    }
    return &Client{
        conn:       conn,
        client:     chatbotv2.NewChatbotServiceClient(conn),
        RPCTimeout: DefaultRPCTimeout,
    }, nil
}

The default value is 1 minute. It should be enough in my practices.

Are you trying to generate very long sentences or suffering from a bad network connection? I suggest editing the InitialPrompt config to prompt ChatGPT to say short sentences. This may be helpful.

ilNikk commented 1 year ago

Are you trying to generate very long sentences or suffering from a bad network connection? I suggest editing the InitialPrompt config to prompt ChatGPT to say short sentences. This may be helpful.

I dont think it that problem maybe there is some problem with openai service? becouse i have this problem only in these days.. I also put all code in new VM on my proxmox (no firewall) server and still same

more detailed logs of compose

muvtuber-muvtuberdriver-1     | 2023/06/26 16:37:38 INFO [TextInFromHTTP] recv TextIn from HTTP. author=user priority=2 content="test"
muvtuber-muvtuberdriver-1     | 2023/06/26 16:37:38 INFO [PriorityReduceFilter] outputMaxPriorityOne boost Priority -> Highest author=user content="test" priority=2
muvtuber-muvtuberdriver-1     | 2023/06/26 16:37:38 INFO [PrioritizedChatbot] Chat(user): "test"
muvtuber-muvtuberdriver-1     | 2023/06/26 16:37:38 INFO [chatbot] SessionClient Chat: got textIn: chatbotName=ChatGPTChatbot textin=test
muvtuber-muvtuberdriver-1     | 2023/06/26 16:37:38 INFO [chatbot] SessionClient Chat: NewClient created. chatbot=ChatGPTChatbot addr=chatgpt_chatbot:50052
muvtuber-chatgpt_chatbot-1    | WARNING:root:ChatGPTProxy._new_chatgpt failed to get initial_response: 'ChatGPTv3' object has no attribute 'initial_response'
muvtuber-chatgpt_chatbot-1    | INFO:root:ChatGPTgRPCServer.NewSession: (OK) session_id=ad59e49a-7284-43e5-948f-3ae305f063fe
muvtuber-muvtuberdriver-1     | 2023/06/26 16:37:39 INFO [chatbot] SessionClient Chat: NewSession created. chatbot=ChatGPTChatbot addr=chatgpt_chatbot:50052 sessionID=ad59e49a-7284-43e5-948f-3ae305f063fe
muvtuber-muvtuberdriver-1     | 2023/06/26 16:37:54 WARN [chatbot] ChatGPTChatbot Chat() failed. The SessionClient will be released if successive failures: serAddr=chatgpt_chatbot:50052 failures=1/3 err=Chat(addr=chatgpt_chatbot:50052) failed: rpc error: code = DeadlineExceeded desc = Deadline Exceeded
muvtuber-muvtuberdriver-1     | 2023/06/26 16:37:54 ERROR [PrioritizedChatbot] all Chatbots failed: Chat() failed. The SessionClient will be released if successive failures: serAddr=chatgpt_chatbot:50052 failures=1/3 err=Chat(addr=chatgpt_chatbot:50052) failed: rpc error: code = DeadlineExceeded desc = Deadline Exceeded, return nil
muvtuber-muvtuberdriver-1     | 2023/06/26 16:37:54 ERROR chatbot.Chat(&{user test 2}) failed: Chat() failed. The SessionClient will be released if successive failures: serAddr=chatgpt_chatbot:50052 failures=1/3 err=Chat(addr=chatgpt_chatbot:50052) failed: rpc error: code = DeadlineExceeded desc = Deadline Exceeded
muvtuber-chatgpt_chatbot-1    | WARNING:root:ChatGPT ask error: 502 Bad Gateway {"error":{"code":502,"message":"Bad gateway.","param":null,"type":"cf_bad_gateway"}}
muvtuber-chatgpt_chatbot-1    | WARNING:root:ChatGPTgRPCServer.Chat: (StatusCode.UNAVAILABLE) b'502 Bad Gateway {"error":{"code":502,"message":"Bad gateway.","param":null,"type":"cf_bad_gateway"}}'

after long time

muvtuber-chatgpt_chatbot-1    | INFO:root:ChatGPTgRPCServer.Chat: (OK) test pass 

chatgpt_chatbot logs

INFO:root:gRPC reflection enabled.
WARNING:root:ChatGPTProxy._new_chatgpt failed to get initial_response: 'ChatGPTv3' object has no attribute 'initial_response'
INFO:root:ChatGPTgRPCServer.NewSession: (OK) session_id=a97178d4-d489-4ca0-9b40-98925f9e9c7d
INFO:root:ChatGPTgRPCServer.Chat: (OK) test pass

in this case I didnt change nothing on the original code, all the port are setted by default (using docker compose) 🤔 some time run perfecty some times not (like 3 message passed of 10), thats so strange

cdfmlr commented 1 year ago

Sorry for my delayed response. As you mentioned that this may be a temporary issue to blame OpenAI. And there were days pass, I am wondering if the problem's still existing.