Bug 28808 - Too many open files => unable to save solution file => lost work + can't restore package references
Summary: Too many open files => unable to save solution file => lost work + can't rest...
Status: CONFIRMED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: 5.9
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: master
Assignee: Lluis Sanchez
URL:
Depends on:
Blocks:
 
Reported: 2015-04-06 09:10 UTC by david
Modified: 2017-03-24 18:07 UTC (History)
13 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Log file showing Too many files exception (11.18 KB, application/zip)
2015-06-19 18:41 UTC, david
Details
Too many open files exception log file (9.39 KB, application/zip)
2015-06-21 18:09 UTC, david
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 28808 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description david 2015-04-06 09:10:59 UTC
Updated to XS 5.9 on MacOS X 10.10.2 over the weekend and did some work.

The computer went to sleep a few times while the solution was open.

Eventually XS complained about "too many open files" and started playing up.

I quit the program, but the quit wiped the contents of my .sln file.

Now I've been rebuilding the solution by importing the files that are still there into a new copy of the solution.

I restored the packages by editing the package.config file in each project as I recreated it. However this doesn't appear to add references to the packages into the References folder and so now I have loads of build errors from unreferenced packages.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2015-04-06 14:36:54 UTC
Increasing severity to critical based on the description "wiped the contents of my .sln file."
Comment 3 david 2015-04-28 18:11:58 UTC
FWIW this happened again just now, following an exception in the registration subsystem.

The exception:

System.IO.IOException: Error creating standard output pipe
  at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x0019f] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System/System.Diagnostics/Process.cs:1029 
  at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x0008b] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System/System.Diagnostics/Process.cs:1163 
  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001e] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/mcs/class/System/System.Diagnostics/Process.cs:1183 
  at Xamarin.Components.Ide.Activation.ProcessUtils.StartProcess (System.Diagnostics.ProcessStartInfo psi, System.IO.TextWriter stdout, System.IO.TextWriter stderr, CancellationToken cancellationToken) [0x00091] in /Users/builder/data/lanes/1494/75607267/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/ProcessUtils.cs:32 
  at Xamarin.Components.Ide.Activation.XamarinEntitlements.FetchEntitlements (Xamarin.Components.Ide.Activation.LicenseToolInfo info) [0x0004c] in /Users/builder/data/lanes/1494/75607267/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/XamarinEntitlements.cs:245 
  at Xamarin.Components.Ide.Activation.ActivationHandler.WriteLicenseToDisk (System.Threading.Tasks.Task`1 t) [0x00368] in /Users/builder/data/lanes/1494/75607267/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/ActivationHandler.cs:474 
  at Xamarin.Components.Ide.Activation.ActivationHandler+<LicenseSync>c__AnonStorey2.<>m__1 (System.Threading.Tasks.Task`1 t) [0x00008] in /Users/builder/data/lanes/1494/75607267/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/ActivationHandler.cs:385 
  at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[Xamarin.Components.Ide.ApiClients.ActivationResult,System.Threading.Tasks.Task`1[Xamarin.Components.Ide.Activation.LicenseSyncResult]].InnerInvoke () [0x00027] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:207 
  at System.Threading.Tasks.Task.Execute () [0x00016] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.0/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:2523 


My system's details:

=== Xamarin Studio ===

Version 5.9 (build 431)
Installation UUID: 8f324999-acba-401e-94d3-2be4721766b6
Runtime:
	Mono 4.0.0 ((detached/d136b79)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000143

=== Xamarin.Android ===

Version: 4.20.1.0 (Business Edition)
Android SDK: /Users/davidd/Development/adt-bundle-mac-x86_64-20131030/sdk
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

Version: 8.10.0.266 (Business Edition)
Hash: c8648f0
Branch: master
Build date: 2015-04-21 12:22:24-0400

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 509000431
Git revision: 7560726734fc7267de2fa9abed2509968deefaa8
Build date: 2015-04-17 19:25:48-04
Xamarin addins: 2e772c734ab3148054eae7bf8949f340fdeb5e5e

=== Operating System ===

Mac OS X 10.10.3
Darwin macbookpro.home 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64



Cody from your support team is also looking into the issue from a different angle. I've noticed that the exception occurs after several days of transitioning my laptop from sleep to wake and from WiFi to wired networks and back. There isn't a specific pattern that I can discover but if Xamarin Studio stays alive through all these transitions, at some point it will throw this exception. It seems to be necessary to quit and restart Xamarin Studio occasionally to fix the problem once it occurs.
Comment 4 david 2015-06-02 08:16:10 UTC
Further notes: it happened again yesterday morning - Monday here in Oz - after a weekend of inactivity on the laptop. I got it from my desk, closed the lid, disconnected all the cables, stuffed it in my bag and headed for the station to catch my train. Once on the train I opened the lid, so the laptop woke up and started running Xamarin Studio again. Immediately I received an "Unhandled Activation Exception" as follows:

System.IO.IOException: Error creating standard output pipe
at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x0019f] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/System/System.Diagnostics/Process.cs:1029
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x0008b] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/System/System.Diagnostics/Process.cs:1163
at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001e] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/mcs/class/System/System.Diagnostics/Process.cs:1183
at Xamarin.Components.Ide.Activation.ProcessUtils.StartProcess (System.Diagnostics.ProcessStartInfo psi, System.IO.TextWriter stdout, System.IO.TextWriter stderr, CancellationToken cancellationToken) [0x00091] in /Users/builder/data/lanes/1494/43735a4b/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/ProcessUtils.cs:32
at Xamarin.Components.Ide.Activation.XamarinEntitlements.FetchEntitlements (Xamarin.Components.Ide.Activation.LicenseToolInfo info) [0x0004c] in /Users/builder/data/lanes/1494/43735a4b/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/XamarinEntitlements.cs:245
at Xamarin.Components.Ide.Activation.ActivationHandler.WriteLicenseToDisk (System.Threading.Tasks.Task`1 t) [0x00368] in /Users/builder/data/lanes/1494/43735a4b/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/ActivationHandler.cs:474
at Xamarin.Components.Ide.Activation.ActivationHandler+<LicenseSync>c__AnonStorey2.<>m__1 (System.Threading.Tasks.Task`1 t) [0x00008] in /Users/builder/data/lanes/1494/43735a4b/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/ActivationHandler.cs:385
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[Xamarin.Components.Ide.ApiClients.ActivationResult,System.Threading.Tasks.Task`1[Xamarin.Components.Ide.Activation.LicenseSyncResult]].InnerInvoke () [0x00027] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/external/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:207
at System.Threading.Tasks.Task.Execute () [0x00016] in /private/tmp/source-mono-mac-4.0.0-branch/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.1/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:2523

Xamarin info:

=== Xamarin Studio ===

Version 5.9.2 (build 2)
Installation UUID: 8f324999-acba-401e-94d3-2be4721766b6
Runtime:
	Mono 4.0.1 ((detached/ed1d3ec)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400010044

=== Xamarin.Android ===

Version: 4.20.1.0 (Business Edition)
Android SDK: /Users/davidd/Development/adt-bundle-mac-x86_64-20131030/sdk
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.3.1 (7703)
Build 6D1002

=== Xamarin.iOS ===

Version: 8.10.1.56 (Business Edition)
Hash: b39367d
Branch: master
Build date: 2015-05-14 08:50:11-0400

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 509020002
Git revision: 43735a4b905b571f69cf9428a3ea7b52aef55476
Build date: 2015-05-18 09:38:12-04
Xamarin addins: ab18ddff45f507ed74f36c2b65df9aee22e28a56

=== Operating System ===

Mac OS X 10.10.3
Darwin macbookpro.local 14.3.0 Darwin Kernel Version 14.3.0
    Mon Mar 23 11:59:05 PDT 2015
    root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64




The interesting thing is that (yet again) the auto-download dialog was open behind the exception notice, with a new update of the D Language bindings that it was offering to install.

I have now switched off the auto-download feature on the upgrader because this is becoming pretty inconvenient. I have noticed that the auto-download and subsequent dialog offering the upgrade to the latest features are often the cause of much instability in the IDE. I can't count the number of times I've had to restart the whole IDE to compensate for some internal shortcoming of the auto-download facility. I've left it switched on up to now in hopes that the info it generates will help track down and eliminate the bug. I'm happy to switch it back on again if an engineer needs specific information, but for now I'll leave it switched off and see if the IDE will let me get some work done.
Comment 5 david 2015-06-02 08:23:02 UTC
One more detail: the other thing I noticed when this bug struck the latest time was that my Solution's Startup Project details had been wiped. Normally I leave the Startup Project as either the iOS or Android code, but after I had recovered from the bug the Solution showed the PCL as the Startup Project. Quite apart from being different than how I left it (so what else got changed in the Solution file?) it makes no sense to have a PCL as a Startup Project, at least in iOS and Android work.
Comment 6 Dylan Kelly 2015-06-04 11:28:35 UTC
I am also experiencing this "Too many open files" error. After leaving my computer on over multiple days, during which the computer went to sleep, upon returning I am unable to open any new files. When I went to go check the environment info under Xamarin Studio > About Xamarin Studio > Show Details, I received the message "Failed to load version information." When I closed XS, I again received the error "Unable to close solution Too many open files." My solution file, however, was not wiped. After restarting XS I was again able to open files.

IDE Log: https://gist.github.com/dylankelly5/0e46780e4e4d9f5dbb01
Environment info: https://gist.github.com/dylankelly5/165c6f7e3071dcf6106b
Comment 7 Lluis Sanchez 2015-06-16 08:23:59 UTC
I fixed an issue that might have caused the solution file wipe, although it is hard to tell. When the process runs out of file handles, weird things can happen.

About the "Too many open files" error, this might be caused by a known leak in the git add-in, which will be fixed in XS 5.10. In any case, it would be useful if you can attach a list of open files when this happens. To get the list, open the Activity Monitor, double click on the Xamarin Studio process, and then click on "Open files and ports".
Comment 8 Dylan Kelly 2015-06-17 17:33:05 UTC
Here is a list of open files and ports: https://gist.github.com/dylankelly5/bf4cdd1868c73e19a312
Environment info: https://gist.github.com/dylankelly5/e7dbdadb7c59506dbf80

I had two solutions open with this occurred.
Comment 9 david 2015-06-19 18:41:08 UTC
Created attachment 11691 [details]
Log file showing Too many files exception

So it happened again.

There are a few things to say, after I've browsed through the enclosed log file.

1. Your timestamps are wrong. I'm in GMT+10 and the timestamps are all marked as Z with my local time on them.

2. Your logic for finding the correct simulator to run isn't working. From Xcode I installed the iOS SDKs for 7.1, 8.1 and 8.2 in addition to the default 8.3, but the log file is complaining that it can't find 8.2.

3. There are lots of "Pango-Warning" exceptions.

4. The current round of errors started when I began editing some files that I had left open overnight. The key line is this one:

ERROR [2015-06-20 08:06:45Z]: Error in auto save while creating: /Users/davidd/Documents/Projects/C-sharp/Ecmo/iOS/Renderers/BaseImageRenderer.cs. Disableing auto save.

This occurred pretty much immediately that I started the edit session, after waking the machine up from its overnight sleep. (08:06 is my local time when I started editing, but I'm in Sydney, Australia - definitely not Zulu time).

5. Xamarin Studio is 5.9.4.5, which I think is the latest Alpha. I haven't yet restarted XS because I wanted to get these details recorded first.
Comment 10 david 2015-06-19 21:23:43 UTC
[Later]

Restarted both computer and Xamarin Studio and all appears to be working again.
Comment 11 david 2015-06-21 18:09:58 UTC
Created attachment 11701 [details]
Too many open files exception log file

Enclosed log file shows history as recorded by XS leading up to a failure I experienced (again) on the train this morning. I removed the Ethernet cable from the laptop, closed the lid (it was already asleep) and packed it in my bag.
On the train I opened the lid and received an exception report:

System.IO.IOException: Error creating standard output pipe
  at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x0019f] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/mcs/class/System/System.Diagnostics/Process.cs:1029 
  at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x0008b] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/mcs/class/System/System.Diagnostics/Process.cs:1163 
  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x0001e] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/mcs/class/System/System.Diagnostics/Process.cs:1183 
  at Xamarin.Components.Ide.Activation.ProcessUtils.StartProcess (System.Diagnostics.ProcessStartInfo psi, System.IO.TextWriter stdout, System.IO.TextWriter stderr, CancellationToken cancellationToken) [0x00091] in /Users/builder/data/lanes/1881/8010a90f/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/ProcessUtils.cs:32 
  at Xamarin.Components.Ide.Activation.XamarinEntitlements.FetchEntitlements (Xamarin.Components.Ide.Activation.LicenseToolInfo info) [0x0004c] in /Users/builder/data/lanes/1881/8010a90f/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/XamarinEntitlements.cs:245 
  at Xamarin.Components.Ide.Activation.ActivationHandler.WriteLicenseToDisk (System.Threading.Tasks.Task`1 t) [0x00368] in /Users/builder/data/lanes/1881/8010a90f/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/ActivationHandler.cs:474 
  at Xamarin.Components.Ide.Activation.ActivationHandler+<LicenseSync>c__AnonStorey2.<>m__1 (System.Threading.Tasks.Task`1 t) [0x00008] in /Users/builder/data/lanes/1881/8010a90f/source/md-addins/Xamarin.Ide/Xamarin.Components.Ide/Activation/ActivationHandler.cs:385 
  at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[Xamarin.Components.Ide.ApiClients.ActivationResult,System.Threading.Tasks.Task`1[Xamarin.Components.Ide.Activation.LicenseSyncResult]].InnerInvoke () [0x00027] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/threading/Tasks/TaskContinuation.cs:207 
  at System.Threading.Tasks.Task.Execute () [0x00016] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr2/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.2/external/referencesource/mscorlib/system/threading/Tasks/Task.cs:2523 

The log file shows that the problem started around 11pm last night when the "phone home" licence sync process failed for some reason not shown in the log.

If you need further information please contact me direct.
Comment 12 PJ 2015-07-13 12:49:57 UTC
Thanks for the info David. Updating milestone to reflect our current target.
Comment 13 Dylan Kelly 2015-07-16 11:34:22 UTC
I just had this occur again, after leaving XS, with a solution open, untouched for about 36 hours.

IDE Log: https://gist.github.com/dylankelly5/9af5e5b5bf86941ed00f
Open files and ports: https://gist.github.com/dylankelly5/551c95a41ccb8f9a2d99
Environment info: https://gist.github.com/dylankelly5/ad29e1e9bfd965feffd2
Comment 16 pperera 2016-02-20 04:06:34 UTC
I'm also seeing the 'Too many files open' issue.

I see it happen more often if I lock my mac's screen more often, with XS open. Might be tied to the root cause.

running on XS 5.10.2
Comment 19 Ben Beckley 2016-10-10 15:56:53 UTC
I have also hit this error after leaving XS open for about 10 days. The Mac machine did not go to sleep and was unlocked the whole time. Upon going to the "Check for Updates..." window, I received the errors. I did not have a solution open.

IDE Log: https://gist.github.com/BenBeckley/b905d4de1db9dc373498e81b57891ecd
Env Info: https://gist.github.com/BenBeckley/00a8af2f5290611ef34445fa3a4539b9
Comment 20 Brendan Zagaeski (Xamarin Team, assistant) 2017-03-24 18:07:46 UTC
## Cross-referencing note

In Comment 8 and Comment 13 the majority of the open files are:
> ->(none)

Comment 8:   935 "->(none)" lines
Comment 13: 1256 "->(none)" lines


If I have followed the reasoning on related Bug 53685 correctly, then there's a chance the candidate change from Bug 53685, Comment 6 (that adds a finalizer for Mono's MemoryMappedFile) might solve the root cause of this issue across both bug reports.