flutter/flutter

[engine] io.worker thread pool sizing

Open

#135.525 aperta il 26 set 2023

Vedi su GitHub
 (5 commenti) (1 reazione) (0 assegnatari)Dart (30.366 fork)batch import
P2e: embedderenginegood first issueplatform-linuxteam-enginetriaged-engine

Metriche repository

Star
 (176.322 star)
Metriche merge PR
 (Merge medio 7g 7h) (491 PR mergiate in 30 g)

Descrizione

Is there an existing issue for this?

Steps to reproduce

On a Linux machine with many HW threads run any embedder.

Expected results

Not to have io.worker thread pool to create a thread per hardware thread

Actual results

io.worker thread pool creates a thread per CPU hardware thread. It looks like it's using std::thread::hardware_concurrency() to determine thread size. On a 16 Core machine (32 HW threads), it creates 32 threads. On a 24 Core machine (48 HW threads), it creates 48 threads.

Code sample

NA

Screenshots or Video

No response

Logs

(gdb) info threads
  Id   Target Id                                             Frame 
* 1    Thread 0x7ffff7edc2c0 (LWP 1077245) "homescreen"      0x00007ffff72f8413 in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6
  2    Thread 0x7ffff4fff6c0 (LWP 1077248) "homescreen"      0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  3    Thread 0x7fffeb1ff6c0 (LWP 1077249) "homescreen:cs0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  4    Thread 0x7fffea8bd6c0 (LWP 1077250) "homescr:disk$0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  5    Thread 0x7fffea0bc6c0 (LWP 1077251) "homescreen:sh0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  6    Thread 0x7fffe98bb6c0 (LWP 1077252) "homescre:shlo0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  7    Thread 0x7fffe8cba6c0 (LWP 1077253) "homescre:gdrv0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  8    Thread 0x7fffe84b96c0 (LWP 1077254) "homescreen:gl0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  9    Thread 0x7fffe7cb86c0 (LWP 1077255) "homescre:gdrv0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  10   Thread 0x7fffe74b76c0 (LWP 1077256) "homescreen:gl0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  11   Thread 0x7fffe6c7f6c0 (LWP 1077257) "homescre:gdrv0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  12   Thread 0x7fffe642d6c0 (LWP 1077258) "homescreen:gl0"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  13   Thread 0x7fffe5c106c0 (LWP 1077259) "homescreen"      0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  14   Thread 0x7fffdffc96c0 (LWP 1077260) "io.flutter.ui"   0x00007ffff7334c72 in epoll_wait () from /lib64/libc.so.6
  15   Thread 0x7fffdf7ba6c0 (LWP 1077261) "homescreen"      0x00007ffff7334c72 in epoll_wait () from /lib64/libc.so.6
  16   Thread 0x7fffdef9d6c0 (LWP 1077262) "io.flutter.io"   0x00007ffff7334c72 in epoll_wait () from /lib64/libc.so.6
  17   Thread 0x7fffd83ff6c0 (LWP 1077263) "io.worker.1"     0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  18   Thread 0x7fffd7bfe6c0 (LWP 1077264) "io.worker.2"     0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  19   Thread 0x7fffd73fd6c0 (LWP 1077265) "io.worker.3"     0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  20   Thread 0x7fffd6bfc6c0 (LWP 1077266) "io.worker.4"     0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  21   Thread 0x7fffd63fb6c0 (LWP 1077267) "io.worker.5"     0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  22   Thread 0x7fffd5bfa6c0 (LWP 1077268) "io.worker.6"     0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  23   Thread 0x7fffd53f96c0 (LWP 1077269) "io.worker.7"     0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  24   Thread 0x7fffd4bf86c0 (LWP 1077270) "io.worker.8"     0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  25   Thread 0x7fffd43f76c0 (LWP 1077271) "io.worker.9"     0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  26   Thread 0x7fffd3bf66c0 (LWP 1077272) "io.worker.10"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  27   Thread 0x7fffd33f56c0 (LWP 1077273) "io.worker.11"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  28   Thread 0x7fffd2bf46c0 (LWP 1077274) "io.worker.12"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  29   Thread 0x7fffd23f36c0 (LWP 1077275) "io.worker.13"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  30   Thread 0x7fffd1bf26c0 (LWP 1077276) "io.worker.14"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  31   Thread 0x7fffd13f16c0 (LWP 1077277) "io.worker.15"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  32   Thread 0x7fffd0bf06c0 (LWP 1077278) "io.worker.16"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  33   Thread 0x7fffd03ef6c0 (LWP 1077279) "io.worker.17"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  34   Thread 0x7fffcfbee6c0 (LWP 1077280) "io.worker.18"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  35   Thread 0x7fffcf3ed6c0 (LWP 1077281) "io.worker.19"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  36   Thread 0x7fffcebec6c0 (LWP 1077282) "io.worker.20"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  37   Thread 0x7fffce3eb6c0 (LWP 1077283) "io.worker.21"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  38   Thread 0x7fffcdbea6c0 (LWP 1077284) "io.worker.22"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  39   Thread 0x7fffcd3e96c0 (LWP 1077285) "io.worker.23"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  40   Thread 0x7fffccbe86c0 (LWP 1077286) "io.worker.24"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  41   Thread 0x7fffcc3e76c0 (LWP 1077287) "io.worker.25"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  42   Thread 0x7fffcbbe66c0 (LWP 1077288) "io.worker.26"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  43   Thread 0x7fffcb3e56c0 (LWP 1077289) "io.worker.27"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  44   Thread 0x7fffcabe46c0 (LWP 1077290) "io.worker.28"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  45   Thread 0x7fffca3e36c0 (LWP 1077291) "io.worker.29"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  46   Thread 0x7fffc9bd46c0 (LWP 1077292) "io.worker.30"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  47   Thread 0x7fffc93b76c0 (LWP 1077293) "io.worker.31"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  48   Thread 0x7fffc8b9a6c0 (LWP 1077294) "io.worker.32"    0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  49   Thread 0x7fffc836f6c0 (LWP 1077295) "dart:io EventHa" 0x00007ffff7334c72 in epoll_wait () from /lib64/libc.so.6
  50   Thread 0x7fffc7cc16c0 (LWP 1077296) "DartWorker"      0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  51   Thread 0x7fffc727f6c0 (LWP 1077297) "DartWorker"      0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  52   Thread 0x7fffc717e6c0 (LWP 1077298) "DartWorker"      0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  53   Thread 0x7fffc66ff6c0 (LWP 1077299) "DartWorker"      0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  54   Thread 0x7fffc65fe6c0 (LWP 1077300) "DartWorker"      0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  55   Thread 0x7fffbc1ff6c0 (LWP 1077303) "dart:io Process" 0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  56   Thread 0x7fffbb87f6c0 (LWP 1077304) "DartWorker"      0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  58   Thread 0x7fffb3c3c6c0 (LWP 1077316) "homescreen:sh1"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  59   Thread 0x7fffb343b6c0 (LWP 1077317) "homescreen:sh2"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  60   Thread 0x7fffb2c3a6c0 (LWP 1077318) "homescreen:sh3"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  61   Thread 0x7fffb24396c0 (LWP 1077319) "homescreen:sh4"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  62   Thread 0x7fffb1c386c0 (LWP 1077320) "homescreen:sh5"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  63   Thread 0x7fffb14376c0 (LWP 1077321) "homescreen:sh6"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  64   Thread 0x7fffafa7f6c0 (LWP 1077322) "homescre:shlo1"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6
  65   Thread 0x7fffaf27e6c0 (LWP 1077323) "homescre:shlo2"  0x00007ffff72ab219 in __futex_abstimed_wait_common () from /lib64/libc.so.6

Flutter Doctor output

[!] Flutter (Channel [user-branch], 3.15.0-15.2.pre, on Fedora Linux 38 (Workstation Edition) 6.4.15-200.fc38.x86_64, locale en_US.UTF-8)
    ! Flutter version 3.15.0-15.2.pre on channel [user-branch] at /mnt/raid10/workspace-automation/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
    • Framework revision 0d074ced6c (5 days ago), 2023-09-21 10:24:15 -0700
    • Engine revision 453411bcf3
    • Dart version 3.2.0 (build 3.2.0-134.1.beta)
    • DevTools version 2.27.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 16.0.6 (Fedora 16.0.6-3.fc38)
    • cmake version 3.27.4
    • ninja version 1.11.1
    • pkg-config version 1.8.0

[✓] VS Code (version 1.82.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.72.0

[✓] Connected device (2 available)
    • Linux (desktop)              • linux              • linux-x64 • Fedora Linux 38 (Workstation Edition) 6.4.15-200.fc38.x86_64
    • Toyota homescreen (mobile)   • homescreen         • linux-x64 • homescreen x86_64

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Guida contributor