Skip to content
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

macOS 下 Snipaste 每隔 5 秒钟左右就扫描一次 Wi-Fi #788

Closed
sunlei opened this issue Jan 15, 2018 · 5 comments
Closed

macOS 下 Snipaste 每隔 5 秒钟左右就扫描一次 Wi-Fi #788

sunlei opened this issue Jan 15, 2018 · 5 comments

Comments

@sunlei
Copy link

sunlei commented Jan 15, 2018

最近发现本机到网关的延迟周期性的升高,很有规律,大约每 10 秒就会出现:

64 bytes from *.*.*.*: icmp_seq=347 ttl=64 time=1.648 ms
64 bytes from *.*.*.*: icmp_seq=348 ttl=64 time=1.242 ms
64 bytes from *.*.*.*: icmp_seq=349 ttl=64 time=1.319 ms
64 bytes from *.*.*.*: icmp_seq=350 ttl=64 time=2.116 ms
64 bytes from *.*.*.*: icmp_seq=351 ttl=64 time=29.329 ms
64 bytes from *.*.*.*: icmp_seq=352 ttl=64 time=12.116 ms
64 bytes from *.*.*.*: icmp_seq=353 ttl=64 time=64.836 ms
64 bytes from *.*.*.*: icmp_seq=354 ttl=64 time=112.894 ms
64 bytes from *.*.*.*: icmp_seq=355 ttl=64 time=1.143 ms
64 bytes from *.*.*.*: icmp_seq=356 ttl=64 time=3.535 ms
64 bytes from *.*.*.*: icmp_seq=357 ttl=64 time=2.123 ms
64 bytes from *.*.*.*: icmp_seq=358 ttl=64 time=2.181 ms
64 bytes from *.*.*.*: icmp_seq=359 ttl=64 time=1.299 ms
64 bytes from *.*.*.*: icmp_seq=360 ttl=64 time=1.290 ms
64 bytes from *.*.*.*: icmp_seq=361 ttl=64 time=1.476 ms
64 bytes from *.*.*.*: icmp_seq=362 ttl=64 time=1.422 ms
64 bytes from *.*.*.*: icmp_seq=363 ttl=64 time=1.277 ms
64 bytes from *.*.*.*: icmp_seq=364 ttl=64 time=1.224 ms
64 bytes from *.*.*.*: icmp_seq=365 ttl=64 time=1.342 ms
64 bytes from *.*.*.*: icmp_seq=366 ttl=64 time=1.271 ms
64 bytes from *.*.*.*: icmp_seq=367 ttl=64 time=17.473 ms
64 bytes from *.*.*.*: icmp_seq=368 ttl=64 time=58.126 ms
64 bytes from *.*.*.*: icmp_seq=369 ttl=64 time=1.054 ms
64 bytes from *.*.*.*: icmp_seq=370 ttl=64 time=2.421 ms
64 bytes from *.*.*.*: icmp_seq=371 ttl=64 time=1.254 ms
64 bytes from *.*.*.*: icmp_seq=372 ttl=64 time=2.591 ms
64 bytes from *.*.*.*: icmp_seq=373 ttl=64 time=1.273 ms
64 bytes from *.*.*.*: icmp_seq=374 ttl=64 time=1.307 ms
64 bytes from *.*.*.*: icmp_seq=375 ttl=64 time=2.319 ms
64 bytes from *.*.*.*: icmp_seq=376 ttl=64 time=1.532 ms
64 bytes from *.*.*.*: icmp_seq=377 ttl=64 time=2.146 ms
64 bytes from *.*.*.*: icmp_seq=378 ttl=64 time=1.903 ms
64 bytes from *.*.*.*: icmp_seq=379 ttl=64 time=42.457 ms
64 bytes from *.*.*.*: icmp_seq=380 ttl=64 time=108.357 ms
64 bytes from *.*.*.*: icmp_seq=381 ttl=64 time=1.325 ms
64 bytes from *.*.*.*: icmp_seq=382 ttl=64 time=14.232 ms
64 bytes from *.*.*.*: icmp_seq=383 ttl=64 time=1.033 ms
64 bytes from *.*.*.*: icmp_seq=384 ttl=64 time=1.277 ms
64 bytes from *.*.*.*: icmp_seq=385 ttl=64 time=1.157 ms
64 bytes from *.*.*.*: icmp_seq=386 ttl=64 time=1.284 ms
64 bytes from *.*.*.*: icmp_seq=387 ttl=64 time=2.044 ms
64 bytes from *.*.*.*: icmp_seq=388 ttl=64 time=1.894 ms
64 bytes from *.*.*.*: icmp_seq=389 ttl=64 time=1.297 ms
64 bytes from *.*.*.*: icmp_seq=390 ttl=64 time=1.887 ms
64 bytes from *.*.*.*: icmp_seq=391 ttl=64 time=1.302 ms
64 bytes from *.*.*.*: icmp_seq=392 ttl=64 time=1.167 ms
64 bytes from *.*.*.*: icmp_seq=393 ttl=64 time=4.992 ms
64 bytes from *.*.*.*: icmp_seq=394 ttl=64 time=61.175 ms
64 bytes from *.*.*.*: icmp_seq=395 ttl=64 time=99.554 ms
64 bytes from *.*.*.*: icmp_seq=396 ttl=64 time=134.440 ms
64 bytes from *.*.*.*: icmp_seq=397 ttl=64 time=1.349 ms
64 bytes from *.*.*.*: icmp_seq=398 ttl=64 time=1.826 ms
64 bytes from *.*.*.*: icmp_seq=399 ttl=64 time=1.910 ms
64 bytes from *.*.*.*: icmp_seq=400 ttl=64 time=1.198 ms

然后在 wifi.log 中发现如下日志:

Mon Jan 15 21:12:17.501 Scan: <airportd[149]> Snipaste requested a live scan less than 10 seconds after previous request (4.5004s) returning cached scan results

Mon Jan 15 21:12:55.799 Scan: <airportd[149]> Snipaste requested a live scan less than 10 seconds after previous request (4.7355s) returning cached scan results

Mon Jan 15 21:13:11.140 Scan: <airportd[149]> Snipaste requested a live scan less than 10 seconds after previous request (5.0591s) returning cached scan results

Mon Jan 15 21:21:18.139 Info: <airportd[29652]> SCAN request received from pid 387 (Snipaste) with priority 0
Mon Jan 15 21:21:18.406 Driver Event: <airportd[29652]> _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0)
Mon Jan 15 21:21:18.409 AutoJoin: <airportd[29652]> Successful cache-assisted scan request for Snipaste with channels {(
Mon Jan 15 21:21:18.409     <CWChannel: 0x************> [channelNumber=1(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:18.409     <CWChannel: 0x************> [channelNumber=2(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:18.409     <CWChannel: 0x************> [channelNumber=3(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:18.409     <CWChannel: 0x************> [channelNumber=4(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:18.409     <CWChannel: 0x************> [channelNumber=5(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:18.409     <CWChannel: 0x************> [channelNumber=6(2GHz), channelWidth={20MHz}, active]
Mon Jan 15 21:21:18.410 )} took 0.2698 seconds, returned 13 results

Mon Jan 15 21:21:22.251 Info: <airportd[29652]> SCAN request received from pid 387 (Snipaste) with priority 0
Mon Jan 15 21:21:22.251 Scan: <airportd[29652]> Snipaste requested a live scan less than 10 seconds after previous request (4.1119s) returning cached scan results
Mon Jan 15 21:21:32.073 Info: <airportd[29652]> SCAN request received from pid 387 (Snipaste) with priority 0
Mon Jan 15 21:21:32.329 Driver Event: <airportd[29652]> _bsd_80211_event_callback: SCAN_CACHE_UPDATED (en0)
Mon Jan 15 21:21:32.332 AutoJoin: <airportd[29652]> Successful cache-assisted scan request for Snipaste with channels {(
Mon Jan 15 21:21:32.332     <CWChannel: 0x************> [channelNumber=1(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:32.332     <CWChannel: 0x************> [channelNumber=2(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:32.332     <CWChannel: 0x************> [channelNumber=3(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:32.332     <CWChannel: 0x************> [channelNumber=4(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:32.333     <CWChannel: 0x************> [channelNumber=5(2GHz), channelWidth={20MHz}, active],
Mon Jan 15 21:21:32.333     <CWChannel: 0x************> [channelNumber=6(2GHz), channelWidth={20MHz}, active]
Mon Jan 15 21:21:32.333 )} took 0.2589 seconds, returned 13 results

从日志中来看, Snipaste 每 5 秒钟就会扫描一次 Wi-Fi ,但是因为太频繁,会被系统拦截,直接返回缓存结果。

Mon Jan 15 21:21:22.251 Scan: <airportd[29652]> Snipaste requested a live scan less than 10 seconds after previous request (4.1119s) returning cached scan results

退出 Snipaste 后,到网关的延迟就正常了。

不明白 Snipaste 为什么要扫描 Wi-Fi,扫描到的信息是上传了还是做了别的处理,就没有再具体分析了。
也有可能是用到的某个组件的行为?

Windows 版是否也存在类似现象?

@liulex
Copy link
Member

liulex commented Jan 15, 2018

5s 是否是你设置的自动更新的检查间隔?除了检查与下载更新,Snipaste 没有任何联网行为,所用到的组件里只有 SingleApplication 会建立一个 local server 进行监听。

至于检查更新是否会导致你所说的扫描 Wi-Fi,我没有测试过,我目前只有虚拟机环境。不过你在 Snipaste 的选项窗口里关掉启动时检查更新,再重启一下 Snipaste 就可以知道了。

如果扫描行为依然存在,那很大可能就是因为 SingleApplication ,不过它建立的只是本地服务器哦。你可以自行下载编译 SingleApplication 验证一下。

关于你的怀疑,Snipaste 欢迎任何人进行更具体的分析,猜疑就没必要了吧 : )

@sunlei
Copy link
Author

sunlei commented Jan 15, 2018

自动更新的间隔是默认的 60 秒, 24 小时,我没有调整过。

关闭 检查更新 后,依然会存在同样的现象。

另外,启动 Snipaste 时会出现

Tue Jan 16 00:49:25.659 <airportd[32404]> ERROR: Snipaste (32405) is not entitled for com.apple.wifi.events, but allowing anyways for event type 1

我没有猜疑,也没有任何恶意,只是说一种可能。

@liulex
Copy link
Member

liulex commented Jan 16, 2018

谢谢你提供的信息 com.apple.wifi.events,看起来是 Qt 的 bug,一直没修复:
https://bugreports.qt.io/browse/QTBUG-40332
https://bugreports.qt.io/browse/QTBUG-58936
keepassxreboot/keepassxc#306

@liulex
Copy link
Member

liulex commented Jan 16, 2018

https://bugreports.qt.io/browse/QTBUG-40332 里提到了一个 workaround,我会在下次更新应用它。

@liulex liulex added the bug label Jan 16, 2018
@Meowzz95
Copy link

Same issue here, almost called apple support for repairing my NIC LOL

@liulex liulex added the done label Jan 20, 2018
@liulex liulex closed this as completed Jan 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants