Repository navigation
running flutter test on OSX results in "Too many open files, errno =24" #2976
Description
Activity
I also get "Flutter quit unexpectedly." halfway through ruinning fltuter test (this is on flutter's package/flutter).ulimit -S -n 2048This works around the too many open files issue on my machine -
but doesn't effect the crashReacted by Aulig, George Chatoutsidis, Sharanya jain, Linxin Xu and tom quasNot 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)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#L81We'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. :/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.- addeda: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specifically
on Apr 1, 2016 We should more gracefully handle running out of file handles.
@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.
I do not know to what you refer. As far as I know this is still broken.
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.
sgtm - leaving it open then!
14 remaining items
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'.
Not sure if it is really fixed so I will leave this opened.
I actually ran into this today just doing a
flutter testrun on my MacBook Pro 15 today. Changingulimitvia the command above works around it.ulimit -S -n 2048I'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.
Can confirm this issue still exists.
ulimit -S -n 2048fixes it, but the command has to be re-ran after switching channels.Reacted by Hu Wyatt and Felipe CesarReacted by Felipe CesarReacted by Felipe CesarStill exists. The command
ulimit -S -n 2048worked for me.Reacted by Felipe Cesar- addedteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
on Jul 7, 2023 macOS 14.3.1 how resolved?

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