Skip to content

We found a serious File descriptor Leak problem which causes application crash #84702

Description

@liangchaojie

1 What it is the problem?

There is a file descriptor leak problem in Flutter. And you Konw that every android phone has a limit of maximum file descriptor. when your application fd(file descriptor) is bigger than the maximum fd,your application will be crash.

2 How to repeat this problem?

this is demo source code
you can run this project and dont need to modify any code but just print the below log
Log.i("TAG", "onCreate: getFdCount " + ProcessUtil.getFdCount());
when you print this log for 5 minutes, you can find the number will be bigeer and bigger.

please use non-Qualcomm cpu mobile phone to test this problem , Qualcomm cpu phone cant repeate this question, May be Flutter cant support other cpu ?

Doctor summary (to see all details, run flutter doctor -v):

[✓] Flutter (Channel unknown, v1.17.112, on macOS 11.4 20F71, locale zh-Hans-CN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Xcode - develop for iOS and macOS (Xcode 12.5)
    ! CocoaPods 1.5.3 out of date (1.8.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade:
        sudo gem install cocoapods
[✓] Android Studio (version 4.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: fatal crashCrashes that terminate the processengineflutter/engine related. See also e: labels.platform-androidAndroid applications specifically

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions