-
-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: 如果端口被占用,不会将端口号增加而是直接抛出端口占用错误 #873
Comments
找到报错的地方了: 似乎是这里的 |
好奇怪的问题……我到处都没有找到与它相关的代码,自己写一个 |
Je n'arrive pas à reproduire ce problème sur Windows 11 Pro 21H1 22000.1219. Vous utilisez le WSL ou non ? Edit : ajouter la traduction 我无法在 Windows 11 Pro 21H1 22000.1219 上重现此问题。 您是否使用 WSL? |
并没有,在我的电脑上只启用了hyper-v |
您的意思是在您的电脑上能正常自动增加端口号? |
Oops, I found that I set different ports in my multiple instances of koishi already in the config files and I clearly forgot that.
|
研究了一下,确实根本没触发 error 和 listening 事件,也没有在 我感觉我与 portfinder 的逻辑是一致的,不知道为何没有效果。 参考:https://www.npmjs.com/package/portfinder?activeTab=explore |
I tested with this simple script and I could get const http = require('http')
const server = http.createServer(() => {})
server.once('listening', () => console.log('listening'))
server.once('error', (err) => console.log('err', err))
server.once('close', console.log)
server.listen(8089) |
Describe the bug
如果端口被占用,不会将监听端口号增加以寻找可用端口,直到找到可用端口为止或者达到
maxPort
上限,而是直接抛出端口占用错误。Steps to reproduce
将
port
所指定的端口号占用,然后启动一个新的koishi实例,这时候koishi将会直接抛出端口占用错误。Expected behavior
port
所指定的端口号占用后,koishi会将监听的端口号增加以寻找可用端口,直到找到可用端口为止或者达到maxPort
上限。Screenshots
Versions
Additional context
No response
The text was updated successfully, but these errors were encountered: