flutter / flutter/devtools

DevTools bind to already used port

未关闭
#2,842 2 条评论 6 个 reaction 已指派 0 人 在 GitHub 查看
cross-screen P3
主要语言
Dart
星标
1.7k
派生
404
平均合并
6 天 17 小时
30 天内合并 PR
18

描述

When I start a flutter app while I am already running a docker container with binding to port 9100, the flutter devtools take over that port.

OS: MacOS 11.2.3
Docker: Docker Desktop 3.2.2.

```bash
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.3, on macOS 11.2.3 20D91 darwin-x64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.54.3)
[✓] Connected device (2 available)
! Device emulator-5554 is offline.

• No issues found!
```

Before running my flutter app:
```bash
$ sudo lsof -i :9100
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
com.docke 1388 florianbauer 121u IPv6 0xc1e172b3ec4f6581 0t0 TCP *:hp-pdl-datastr (LISTEN)
```

After running my flutter app:
```bash
$ sudo lsof -i :9100
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
com.docke 1388 florianbauer 121u IPv6 0xc1e172b3ec4f6581 0t0 TCP *:hp-pdl-datastr (LISTEN)
dart 17171 florianbauer 9u IPv4 0xc1e172b3f0526121 0t0 TCP localhost:hp-pdl-datastr (LISTEN)
dart 17171 florianbauer 10u IPv6 0xc1e172b3ec4f5f21 0t0 TCP localhost:hp-pdl-datastr (LISTEN)
```

The result of this is, that I cannot connect to my docker service anymore, until I stop the dart process.

Addition:
I am starting the Flutter app from VSCode and inside the settings.json of VSCode I placed this:
```json
{
"dart.devToolsPort": 10999
}
```
When I am opening the devtools from VSCode in Chrome the browser opens on 127.0.0.1:10999, which is correct. But still there is also a dart process binding to port 9100. When I run `curl 127.0.0.1:9100` I can see that there are also devtools running.

This behavior started after I updated to Flutter 2.0.3. And two colleagues, that work on the same project, just experienced this issue as well.

贡献指南

打开贡献指南

调研方向

通过使用 Docker 占用端口 9100、从 VS Code 启动 Flutter 应用,并使用 lsof 或 curl 检查监听器来复现该问题。将配置的 dart.devToolsPort 值 10999 与 9100 上额外的 DevTools 监听器进行比较;当 DevTools 使用预期端口且不影响 Docker 服务时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
dart
领域
tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。