Skip to content

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

Description

@sunlei

最近发现本机到网关的延迟周期性的升高,很有规律,大约每 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 版是否也存在类似现象?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions