baptisteArno / typebot.io

💬 Typebot is a powerful chatbot builder that you can self-host.
https://typebot.io
Other
6.94k stars 1.88k forks source link

ContinueChat on viewer hangs at 100% CPU usage #1623

Closed kuon closed 2 weeks ago

kuon commented 2 months ago

Hello,

I noticed that one bot would hang indefinitely at 100% CPU usage sometimes.

I was able to pinpoint the last requests made to the bot before it crashed:

Jul  3 10:04:47 lemon nginx[287196]:  "GET /plastique-sandbox HTTP/2.0" 200 1167 0.013 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
Jul  3 10:04:47 lemon nginx[287196]:  "GET /__ENV.js HTTP/2.0" 304 0 0.002 "https://typebot.memoways.com/plastique-sandbox" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
Jul  3 10:04:48 lemon nginx[287196]: GET /typebot/public/workspaces/clx0ofhfm0001la7d3iliqpx9/typebots/clxixc1ju0001qwwqk9o91bq2/favIcon?v=1719415082560 HTTP/2.0" 200 418242 0.229 "https://typebot.memoways.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
Jul  3 10:04:48 lemon nginx[287196]:  "POST /api/v1/typebots/plastique-sandbox/startChat HTTP/2.0" 200 681 0.184 "https://typebot.memoways.com/plastique-sandbox" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
Jul  3 10:04:48 lemon nginx[287196]:  "GET /plastique-sandbox HTTP/2.0" 200 1167 0.013 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
Jul  3 10:04:49 lemon nginx[287196]:  "GET /__ENV.js HTTP/2.0" 304 0 0.002 "https://typebot.memoways.com/plastique-sandbox" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
Jul  3 10:04:49 lemon nginx[287196]:  "POST /api/v1/typebots/plastique-sandbox/startChat HTTP/2.0" 200 683 0.038 "https://typebot.memoways.com/plastique-sandbox" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
Jul  3 10:04:50 lemon nginx[287196]:  "POST /api/v1/sessions/cly5jyap6000210cch8hcr79k/continueChat HTTP/2.0" 200 928 0.038 "https://typebot.memoways.com/plastique-sandbox" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
Jul  3 10:04:56 lemon nginx[287196]:  "POST /api/v1/sessions/cly5jyap6000210cch8hcr79k/continueChat HTTP/2.0" 200 510 0.032 "https://typebot.memoways.com/plastique-sandbox" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"

I realize it's little to go on, I'll have to try to reproduce it in a debug environment, but maybe you can find something knowing the code.

kuon commented 2 months ago

Apparently the chatbot user, @Ulrfis says it was caused by an "incomplete" chatnode integration.

Ulrfis commented 2 months ago

The API key was missing in the Chatnode setting (because of a change of the API key in the Chatnode back-end)

baptisteArno commented 2 months ago

I honestly have no idea 🤔 I don't think it is linked to Typebot... Is it 100% reproducible? On any bot, or just one?

kuon commented 2 weeks ago

I wasn't able to reproduce this. I investigated and it became clear that it is not a typebot bug. It is more a ky bug or even lower level bug. So I am going to close this.