Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many open files error during _MDResolveAddinReferences #55

Closed
wjk opened this issue Mar 16, 2018 · 1 comment · Fixed by #67
Closed

Too many open files error during _MDResolveAddinReferences #55

wjk opened this issue Mar 16, 2018 · 1 comment · Fixed by #67

Comments

@wjk
Copy link

wjk commented Mar 16, 2018

When I attempt to build a project using the MonoDevelop.Addins nuget package on my MacBook running macOS 10.13.3, it fails with some-odd 295 errors, which all trace back to a "Too many open files" error. Running ulimit -f unlimited has no effect. It started doing this a few weeks ago (around the time of the VSMac 7.4 update, I think), before which addin projects compiled without issue. Until this is resolved, no addin project will build, which is a problem for me because I need to compile several addins from source for my projects. Please advise. Thanks!

@mhutch
Copy link
Owner

mhutch commented May 18, 2018

This is an issue in Mono.Addins, see mono/mono-addins#110 for a workaround

KirillOsenkov added a commit to KirillOsenkov/MonoDevelop.AddinMaker that referenced this issue Nov 3, 2018
The unwritten contract of AddinFileSystemExtension.GetReflectorForFile expects it to cache the Reflector, and the base implementation does that:
https://github.com/mono/mono-addins/blob/e84472dcd17b61a904538e1cc2e19f4b064c7068/Mono.Addins/Mono.Addins.Database/AddinFileSystemExtension.cs#L170

AddinScanner.Dispose() then calls database.FileSystem.CleanupReflector ();:
https://github.com/mono/mono-addins/blob/e84472dcd17b61a904538e1cc2e19f4b064c7068/Mono.Addins/Mono.Addins.Database/AddinScanner.cs#L58

This change does two things:
1. Dispose of the Registry after the ResolveMonoDevelopAddins task is done, which in turn disposes the Cecil Reflector
2. Removes the overridden GetReflectorForFile from CecilReflectorExtension since that is equivalent to the base implementation but without the caching. The base implementation does proper caching.

The fix has many benefits, such as:
1. Not allocating many file handles
2. Cleanup file handles after use
3. Improve build perf from 3.4 to 2.1 seconds on a solution with two addin projects

Fixes mhutch#55
Fixes mhutch#58
@mhutch mhutch closed this as completed in #67 Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants