Skip to content

running flutter test on OSX results in "Too many open files, errno =24" #2976

Description

@apwilson

$ sysctl kern.maxfiles
kern.maxfiles: 12288
$ sysctl kern.maxfilesperproc
kern.maxfilesperproc: 10240

Activity

  1. apwilson commented on Mar 29, 2016

    @apwilson
    ContributorAuthor

    I also get "Flutter quit unexpectedly." halfway through ruinning fltuter test (this is on flutter's package/flutter).

  2. apwilson commented on Mar 29, 2016

    @apwilson
    ContributorAuthor
    ulimit -S -n 2048
    

    This works around the too many open files issue on my machine - but doesn't effect the crash

  3. apwilson commented on Mar 29, 2016

    @apwilson
    ContributorAuthor

    Not sure if this is helpful but this is the start of the stack trace of the thread that crashed:

    Thread 8 Crashed:: ui_thread
    0   org.domokit.sky                 0x000000010ec31967 base::debug::BreakDebugger() + 23 (debugger_posix.cc:240)
    1   org.domokit.sky                 0x000000010ea7e630 logging::LogMessage::~LogMessage() + 2416 (logging.cc:647)
    2   org.domokit.sky                 0x000000010ea7b813 logging::LogMessage::~LogMessage() + 35 (logging.cc:545)
    3   org.domokit.sky                 0x0000000110044e2f blink::FontCache::getFontForCharacter(int, char const*, blink::FontCache::PlatformFallbackFont*) + 143 (FontPlatformDataApple.cpp:81)
    4   org.domokit.sky                 0x000000010ff2d86e blink::FontCache::fallbackFontForCharacter(blink::FontDescription const&, int, blink::SimpleFontData const*) + 366 (FontCacheSkia.cpp:160)
    5   org.domokit.sky                 0x000000010fec893f blink::Font::glyphDataAndPageForCharacter(int, bool, blink::FontDataVariant) const + 2719 (Font.cpp:564)
    6   org.domokit.sky                 0x000000010fecce58 blink::Font::glyphDataForCharacter(int, bool, blink::FontDataVariant) const + 88 (Font.h:129)
    7   org.domokit.sky                 0x000000010ff0f1d9 blink::WidthIterator::glyphDataForCharacter(blink::WidthIterator::CharacterData&) + 169 (WidthIterator.cpp:74)
    8   org.domokit.sky                 0x000000010ff10b7e unsigned int blink::WidthIterator::advanceInternal<blink::SurrogatePairAwareTextIterator>(blink::SurrogatePairAwareTextIterator&, blink::GlyphBuffer*) + 270 (WidthIterator.cpp:191)
    9   org.domokit.sky                 0x000000010ff0fe0b blink::WidthIterator::advance(int, blink::GlyphBuffer*) + 251 (WidthIterator.cpp:243)
    10  org.domokit.sky                 0x000000010fec7487 blink::Font::floatWidthForSimpleText(blink::TextRun const&, WTF::HashSet<blink::SimpleFontData const*, WTF::PtrHash<blink::SimpleFontData const*>, WTF::HashTraits<blink::SimpleFontData const*>, WTF::DefaultAllocator>*, blink::IntRectExtent*) const + 119 (Font.cpp:757)
    11  org.domokit.sky                 0x000000010fec70ea blink::Font::width(blink::TextRun const&, WTF::HashSet<blink::SimpleFontData const*, WTF::PtrHash<blink::SimpleFontData const*>, WTF::HashTraits<blink::SimpleFontData const*>, WTF::DefaultAllocator>*, blink::GlyphOverflow*) const + 730 (Font.cpp:250)
    12  org.domokit.sky                 0x0000000110815903 blink::RenderText::widthFromCache(blink::Font const&, int, int, float, blink::TextDirection, WTF::HashSet<blink::SimpleFontData const*, WTF::PtrHash<blink::SimpleFontData const*>, WTF::HashTraits<blink::SimpleFontData const*>, WTF::DefaultAllocator>*, blink::GlyphOverflow*) const + 1251 (RenderText.cpp:552)
    13  org.domokit.sky                 0x0000000110813340 blink::RenderText::width(unsigned int, unsigned int, blink::Font const&, float, blink::TextDirection, WTF::HashSet<blink::SimpleFontData const*, WTF::PtrHash<blink::SimpleFontData const*>, WTF::HashTraits<blink::SimpleFontData const*>, WTF::DefaultAllocator>*, blink::GlyphOverflow*) const + 816 (RenderText.cpp:1226)
    14  org.domokit.sky                 0x00000001108364d5 blink::textWidth(blink::RenderText*, unsigned int, unsigned int, blink::Font const&, float, bool, bool, WTF::HashSet<blink::SimpleFontData const*, WTF::PtrHash<blink::SimpleFontData const*>, WTF::HashTraits<blink::SimpleFontData const*>, WTF::DefaultAllocator>*) + 325 (BreakingContextInlineHeaders.h:422)
    15  org.domokit.sky                 0x000000011083300b blink::BreakingContext::handleText(WTF::Vector<blink::WordMeasurement, 64ul, WTF::DefaultAllocator>&, bool&) + 8043 (BreakingContextInlineHeaders.h:684)
    16  org.domokit.sky                 0x000000011082ee63 blink::LineBreaker::nextLineBreak(blink::BidiResolver<blink::InlineIterator, blink::BidiRun>&, blink::LineInfo&, blink::RenderTextInfo&, blink::FloatingObject*, WTF::Vector<blink::WordMeasurement, 64ul, WTF::DefaultAllocator>&) + 915 (LineBreaker.cpp:78)
    17  org.domokit.sky                 0x00000001107ff6f2 blink::RenderParagraph::layoutRunsAndFloatsInRange(blink::LineLayoutState&, blink::BidiResolver<blink::InlineIterator, blink::BidiRun>&, blink::InlineIterator const&, blink::BidiStatus const&) + 690 (RenderParagraph.cpp:879)
    18  org.domokit.sky                 0x00000001107feb24 blink::RenderParagraph::layoutRunsAndFloats(blink::LineLayoutState&) + 276 (RenderParagraph.cpp:844)
    19  org.domokit.sky                 0x000000011080214f blink::RenderParagraph::layoutChildren(bool, blink::SubtreeLayoutScope&, blink::LayoutUnit, blink::LayoutUnit) + 1007 (RenderParagraph.cpp:1439)
    20  org.domokit.sky                 0x0000000110801c35 blink::RenderParagraph::layout() + 549 (RenderParagraph.cpp:1372)
    21  org.domokit.sky                 0x00000001107f6fe7 blink::RenderObject::forceChildLayout() + 71 (RenderObject.cpp:1441)
    22  org.domokit.sky                 0x00000001107be3d1 blink::RenderFlexibleBox::preferredMainAxisContentExtentForChild(blink::RenderBox*, bool, bool) + 273 (RenderFlexibleBox.cpp:507)
    23  org.domokit.sky                 0x00000001107be898 blink::RenderFlexibleBox::computeNextFlexLine(WTF::Vector<blink::RenderBox*, 0ul, WTF::DefaultAllocator>&, blink::LayoutUnit&, double&, double&, blink::LayoutUnit&, bool&, bool) + 472 (RenderFlexibleBox.cpp:755)
    24  org.domokit.sky                 0x00000001107bb4a6 blink::RenderFlexibleBox::layoutFlexItems(bool) + 310 (RenderFlexibleBox.cpp:534)
    25  org.domokit.sky                 0x00000001107baf7a blink::RenderFlexibleBox::layout() + 330 (RenderFlexibleBox.cpp:227)
    26  org.domokit.sky                 0x000000011081bd57 blink::RenderView::layout() + 455 (RenderView.cpp:120)
    27  org.domokit.sky                 0x0000000110872cd0 blink::Paragraph::layout() + 480 (Paragraph.cpp:89)
    28  org.domokit.sky                 0x0000000110874d8d blink::DartDispatcher<blink::IndicesHolder<>, void (blink::Paragraph::*)()>::Dispatch(void (blink::Paragraph::*)()) + 157 (dart_args.h:133)
    29  org.domokit.sky                 0x0000000110874c7e void blink::DartCall<void (blink::Paragraph::*)()>(void (blink::Paragraph::*)(), _Dart_NativeArguments*) + 142 (dart_args.h:165)
    30  org.domokit.sky                 0x0000000110872505 blink::Paragraph_layout(_Dart_NativeArguments*) + 69 (Paragraph.cpp:41)
    31  org.domokit.sky                 0x000000011052d35c dart::NativeEntry::NativeCallWrapperNoStackCheck(_Dart_NativeArguments*, void (*)(_Dart_NativeArguments*)) + 716 (native_arguments.h:137)
    
    
  4. eseidelGoogle commented on Mar 29, 2016

    @eseidelGoogle
    Contributor

    That crash point looks like font fallback is failing to find a suitable font. Presumably it didn't expect to go down that path: https://github.com/flutter/engine/blob/master/sky/engine/platform/fonts/apple/FontPlatformDataApple.cpp#L81

    We'd probably have to look at Blink's text code from when we forked. It's wanting to do font measurements on a Mac, which is not a platform our engine has a lot of supporting code for anymore. :/

  5. eseidelGoogle commented on Mar 29, 2016

    @eseidelGoogle
    Contributor

    This feels like two separate issues. One is our holding of the package:test code on Mac and trying to drive too many tests at once. The second is our broken font fallback logic on Mac, resulting in a crash.

  6. added
    a: tests"flutter test", flutter_test, or one of our tests
    platform-macosBuilding on or for macOS specifically
    on Apr 1, 2016
  7. added this to the milestone on Apr 1, 2016
  8. Hixie commented on Oct 14, 2016

    @Hixie
    Contributor

    We should more gracefully handle running out of file handles.

  9. cbracken commented on Feb 10, 2017

    @cbracken
    Member

    @Hixie IIRC you landed a fix related to too many open files on macOS. Is this safe to close or is there still work to do.

  10. Hixie commented on Feb 10, 2017

    @Hixie
    Contributor

    I do not know to what you refer. As far as I know this is still broken.

  11. Hixie commented on Feb 10, 2017

    @Hixie
    Contributor

    Oh the thing you're referring to was my technical debt benchmark. It used to open every file then read them all in parallel, but I changed it to just open them sequentially. That doesn't affect this.

  12. cbracken commented on Feb 10, 2017

    @cbracken
    Member

    sgtm - leaving it open then!

  13. 14 remaining items

  14. removed this from the milestone on Jul 7, 2020
  15. modified the milestone: on Jul 22, 2020
  16. removed this from the milestone on Aug 17, 2020
  17. pedromassangocode commented on Aug 26, 2020

    @pedromassangocode

    I tried to reproduce following the steps in #2976 (comment) and I was unable to reproduce this issue. I run the tests on a 2016 Macbook Pro 13'.

    Screen Shot 2020-08-26 at 14 15 34

    Not sure if it is really fixed so I will leave this opened.

  18. cbracken commented on Aug 29, 2020

    @cbracken
    Member

    I actually ran into this today just doing a flutter test run on my MacBook Pro 15 today. Changing ulimit via the command above works around it.

    ulimit -S -n 2048
    

    I've always worked around this by bumping the limit up in my .zshrc/.bashrc, but it'd be nice if we tried to stick within the value on the user's machine but emit a message that provides steps to bump it up for better performance.

    If it turns out that some individual tests can't run within the limit, then emitting a friendly error message would be much better than the current behaviour.

  19. theniceboy commented on Jan 28, 2021

    @theniceboy
    Contributor

    Can confirm this issue still exists. ulimit -S -n 2048 fixes it, but the command has to be re-ran after switching channels.

  20. hdeleoncidenet commented on Jun 24, 2022

    @hdeleoncidenet

    Still exists. The command ulimit -S -n 2048 worked for me.

  21. gatspy commented on Apr 8, 2024

    @gatspy

    macOS 14.3.1 how resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: tests"flutter test", flutter_test, or one of our testsengineflutter/engine related. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.platform-macosBuilding on or for macOS specificallyteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions