koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.19k stars 235 forks source link

Bug: 热重载插件后报错 #1045

Closed Ice-Hazymoon closed 1 year ago

Ice-Hazymoon commented 1 year ago

Describe the bug

开发模式下,插件修改保存后,出现以下错误,其中 tg api 启用了 socks 代理,tg 也报错了

2023-03-29 20:51:34 [I] watch reload plugin at plugins\chatgpt\src\index.ts
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\@koishijs\plugin-analytics\lib\index.js
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\@koishijs\plugin-dataview\lib\index.cjs
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\@koishijs\plugin-logger\lib\index.js
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\@koishijs\plugin-insight\lib\index.cjs
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\@koishijs\plugin-market\lib\node\index.js
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\@koishijs\plugin-sandbox\lib\index.js
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\@koishijs\plugin-status\lib\index.js
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\@koishijs\plugin-database-mysql\lib\index.js
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\@satorijs\adapter-telegram\lib\index.js
2023-03-29 20:51:34 [I] watch reload plugin at node_modules\koishi-plugin-assets-s3\lib\index.js
2023-03-29 20:51:34 [W] mysql SELECT `TABLE_NAME`,`TABLE_ROWS`,`DATA_LENGTH` FROM information_schema.tables WHERE TABLE_SCHEMA = 'bott'; SELECT `TABLE_NAME`,`TABLE_ROWS`,`DATA_LENGTH` FROM information_schema.tables WHERE TABLE_SCHEMA = 'bott'; SELECT `TABLE_NAME`,`TABLE_ROWS`,`DATA_LENGTH` FROM information_schema.tables WHERE TABLE_SCHEMA = 'bott'; SELECT `TABLE_NAME`,`TABLE_ROWS`,`DATA_LENGTH` FROM information_schema.tables WHERE TABLE_SCHEMA = 'bott'; SELECT `TABLE_NAME`,`TABLE_ROWS`,`DATA_LENGTH` FROM information_schema.tables WHERE TABLE_SCHEMA = 'bott'; SELECT `TABLE_NAME`,`TABLE_ROWS`,`DATA_LENGTH` FROM information_schema.tables WHERE TABLE_SCHEMA = 'bott'; SELECT `TABLE_NAME`,`TABLE_ROWS`,`DATA_LENGTH` FROM information_schema.tables WHERE TABLE_SCHEMA = 'bott'
2023-03-29 20:51:35 [W] app Error: service console.stats has been registered
                            at Context.set (E:\Project\bott-ai-bot\node_modules\cordis\src\context.ts:126:17)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\cordis\src\service.ts:22:15)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-03-29 20:51:35 [W] app Error: service console.database has been registered
                            at Context.set (E:\Project\bott-ai-bot\node_modules\cordis\src\context.ts:126:17)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\cordis\src\service.ts:22:15)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-03-29 20:51:35 [W] app Error: service console.sandbox has been registered
                            at Context.set (E:\Project\bott-ai-bot\node_modules\cordis\src\context.ts:126:17)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\cordis\src\service.ts:22:15)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-03-29 20:51:35 [W] app TypeError: Cannot read properties of undefined (reading 'stats')
                            at DatabaseProvider.getInfo (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-dataview\src\index.ts:73:43)
                            at DatabaseProvider.get (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-dataview\src\index.ts:93:31)
                            at DatabaseProvider.refresh (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-console\src\shared\service.ts:44:25)
                            at DatabaseProvider.start (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-console\src\shared\service.ts:38:10)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\cordis\src\service.ts:21:18)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-03-29 20:51:35 [W] app TypeError: Cannot read properties of undefined (reading 'get')
                            at _StatisticsProvider.download (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-analytics\src\stats.ts:288:25)
                            at _StatisticsProvider.get (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-analytics\src\stats.ts:303:30)
                            at _StatisticsProvider.refresh (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-console\src\shared\service.ts:44:25)
                            at _StatisticsProvider.start (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-console\src\shared\service.ts:38:10)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\cordis\src\service.ts:21:18)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-03-29 20:51:35 [W] app TypeError: Cannot read properties of undefined (reading 'get')
                            at UserProvider.prepare (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-sandbox\src\index.ts:79:42)
                            at UserProvider.get (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-sandbox\src\index.ts:94:31)    
                            at UserProvider.refresh (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-console\src\shared\service.ts:44:25)
                            at UserProvider.start (E:\Project\bott-ai-bot\node_modules\@koishijs\plugin-console\src\shared\service.ts:38:10)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\cordis\src\service.ts:21:18)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-03-29 20:51:35 [W] app Pool is closed.
                            at MySQLDriver.query (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:306:19)    
                            at MySQLDriver._flushTasks (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:339:32)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:329:35)
                            at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
2023-03-29 20:51:35 [W] app Pool is closed.
                            at MySQLDriver.query (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:306:19)    
                            at MySQLDriver._flushTasks (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:339:32)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:329:35)
                            at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
2023-03-29 20:51:35 [W] app Pool is closed.
                            at MySQLDriver.query (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:306:19)    
                            at MySQLDriver._flushTasks (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:339:32)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:329:35)
                            at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
2023-03-29 20:51:35 [W] app Pool is closed.
                            at MySQLDriver.query (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:306:19)    
                            at MySQLDriver._flushTasks (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:339:32)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:329:35)
                            at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
2023-03-29 20:51:35 [W] app Pool is closed.
                            at MySQLDriver.query (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:306:19)    
                            at MySQLDriver._flushTasks (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:339:32)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:329:35)
                            at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
2023-03-29 20:51:35 [W] app Pool is closed.
                            at MySQLDriver.query (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:306:19)    
                            at MySQLDriver._flushTasks (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:339:32)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:329:35)
                            at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
2023-03-29 20:51:35 [W] app Pool is closed.
                            at MySQLDriver.query (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:306:19)    
                            at MySQLDriver._flushTasks (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:339:32)
                            at <anonymous> (E:\Project\bott-ai-bot\node_modules\@minatojs\driver-mysql\src\index.ts:329:35)
                            at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
2023-03-29 20:51:41 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:51:47 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:51:53 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:51:59 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:05 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:11 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:17 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:23 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:29 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:35 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:41 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:47 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:53 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:52:56 [I] watch reload plugin at plugins\chatgpt\src\index.ts
2023-03-29 20:52:56 [I] mysql auto updating table chatpdf
2023-03-29 20:52:59 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:53:05 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:53:12 [W] telegram failed to get updates. reason: Telegram API error 409. Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
2023-03-29 20:53:26 [I] watch reload plugin at plugins\chatgpt\src\index.ts
2023-03-29 20:54:20 [I] watch reload plugin at plugins\chatgpt\src\index.ts
2023-03-29 20:54:25 [I] app terminated by SIGINT

Steps to reproduce

如题

Expected behavior

如题

Screenshots

No response

Versions

Additional context

No response

shigma commented 1 year ago

热重载目前确实不能保证所有情况下可用。不过从你的日志看,你的热重载检测了 node_modules 的变化,这似乎不是预期的。你是否修改了 ignore 配置项?

Ice-Hazymoon commented 1 year ago

没有修改过 node_modules,也没有修改过 ignore,这样的错误经常出现,但想要刻意复现的时候错误又消失了。。。 等我找到具体是啥原因我再来打开这个 issue

shigma commented 1 year ago

没事也可以先留着,关了也行,我先加个 label

Ice-Hazymoon commented 1 year ago

修改语言文件时,热重载后,Telegram 会登陆多次相同账号,然后出现 429 的错误 image

shigma commented 1 year ago

额这个大概是没有关系的,之前我也没见过类似的 report……给我的感觉像是你本地开发环境整个儿都乱套了。可以试试在新的模板项目环境下复现。