Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Can't return a View on OSX when npm or bower packages have been installed #2348

Closed
adriaanp opened this issue Apr 7, 2015 · 27 comments
Closed

Comments

@adriaanp
Copy link

adriaanp commented Apr 7, 2015

Running on Mono and OSX I'm getting the following when returning a View from my controller action.

If I return an object or a string, then it works fine.

I'm using npm to install gulp and bower to install bower components, when removing the npm installed and bower installed files then the exception is not thrown, meaning that somehow these files get used / watched in a way that does not make sense to be watched?

I've played with and increase the ulimit setting for max files to open 1000000 and still get the same exception.

On Windows everything works fine.

An unhandled exception occurred while processing the request.

IOException: kqueue() FileSystemWatcher has reached the maximum nunmber of files to watch.
System.IO.KqueueMonitor.Add (System.String path, Boolean postEvents, System.Collections.Generic.List`1& fds) <0x10dfa8d30 + 0x003ee> in <filename unknown>, line 0

IOException: kqueue() FileSystemWatcher has reached the maximum nunmber of files to watch.
System.IO.KqueueMonitor.Add (System.String path, Boolean postEvents, System.Collections.Generic.List`1& fds) <0x10dfa8d30 + 0x003ee> in <filename unknown>
System.IO.KqueueMonitor.Scan (System.String path, Boolean postEvents, System.Collections.Generic.List`1& fds) <0x10dfa8890 + 0x0037c> in <filename unknown>
System.IO.KqueueMonitor.Setup () <0x10dfa7b50 + 0x002c3> in <filename unknown>
System.IO.KqueueMonitor.DoMonitor () <0x10dfa77e0 + 0x0002f> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x109451970 + 0x000b3> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1094518e0 + 0x0007e> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1094518b0 + 0x0001f> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x109451890 + 0x00012> in <filename unknown>
Microsoft.AspNet.Mvc.Core.FilterActionInvoker+<InvokeResultAsync>d__44.MoveNext () <0x10dd8aab0 + 0x001f2> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x109451970 + 0x000b3> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1094518e0 + 0x0007e> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1094518b0 + 0x0001f> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x109451890 + 0x00012> in <filename unknown>
Microsoft.AspNet.Mvc.Core.FilterActionInvoker+<InvokeResultFilterAsync>d__43.MoveNext () <0x10dd894b0 + 0x00c5e> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
Microsoft.AspNet.Mvc.Core.FilterActionInvoker+<InvokeAllResultFiltersAsync>d__42.MoveNext () <0x10dd88b00 + 0x002f8> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x109451970 + 0x000b3> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1094518e0 + 0x0007e> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1094518b0 + 0x0001f> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x109451890 + 0x00012> in <filename unknown>
Microsoft.AspNet.Mvc.Core.FilterActionInvoker+<InvokeResourceFilterAsync>d__37.MoveNext () <0x10dd69000 + 0x01388> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
Microsoft.AspNet.Mvc.Core.FilterActionInvoker+<InvokeAsync>d__32.MoveNext () <0x10dd60030 + 0x00702> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x109451970 + 0x000b3> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1094518e0 + 0x0007e> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1094518b0 + 0x0001f> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x109451890 + 0x00012> in <filename unknown>
Microsoft.AspNet.Mvc.MvcRouteHandler+<InvokeActionAsync>d__3.MoveNext () <0x10dd5a020 + 0x00354> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x109451970 + 0x000b3> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1094518e0 + 0x0007e> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1094518b0 + 0x0001f> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x109451890 + 0x00012> in <filename unknown>
Microsoft.AspNet.Mvc.MvcRouteHandler+<RouteAsync>d__2.MoveNext () <0x10dd511b0 + 0x006fe> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x109451970 + 0x000b3> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1094518e0 + 0x0007e> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1094518b0 + 0x0001f> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x109451890 + 0x00012> in <filename unknown>
Microsoft.AspNet.Routing.Template.TemplateRoute+<RouteAsync>d__25.MoveNext () <0x10dd4ef30 + 0x007ec> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x109451970 + 0x000b3> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1094518e0 + 0x0007e> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1094518b0 + 0x0001f> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x109451890 + 0x00012> in <filename unknown>
Microsoft.AspNet.Routing.RouteCollection+<RouteAsync>d__10.MoveNext () <0x10dd4d120 + 0x003a6> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x109451970 + 0x000b3> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1094518e0 + 0x0007e> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1094518b0 + 0x0001f> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x109451890 + 0x00012> in <filename unknown>
Microsoft.AspNet.Builder.RouterMiddleware+<Invoke>d__4.MoveNext () <0x10dd4b590 + 0x002da> in <filename unknown>
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1094538a0 + 0x00029> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x109451970 + 0x000b3> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1094518e0 + 0x0007e> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1094518b0 + 0x0001f> in <filename unknown>
System.Runtime.CompilerServices.TaskAwaiter.GetResult () <0x109451890 + 0x00012> in <filename unknown>
Microsoft.AspNet.Diagnostics.ErrorPageMiddleware+<Invoke>d__4.MoveNext () <0x10dd4aaa0 + 0x001f6> in <filename unknown>
@danroth27
Copy link
Member

@adriaanp Could you please share with us your project code so that we investigate?

@danroth27
Copy link
Member

Looks like a Mono issue.

@adriaanp
Copy link
Author

adriaanp commented Apr 8, 2015

Sure here is the repo: https://github.com/adriaanp/gholfreg

If you just do "dnu restore" and "dnx src kestrel" you should be able to hit the home page.

if you do "npm install" to install gulp etc. and then "gulp " to install bower packages.

Then I'm getting the exception above, but hitting the other Test actions does not throw the exception.

@davidfowl
Copy link
Member

It is a mono issue. export MONO_MANAGED_WATCHER=false and see if it works

@Tragetaschen
Copy link
Contributor

It's a known issue on Mono: http://www.mono-project.com/docs/about-mono/releases/3.12.0/

@adriaanp
Copy link
Author

adriaanp commented Apr 8, 2015

yes the MONO_MANAGED_WATCHER works. Just for interest sake why is node_modules and wwwroot stuff being watched ?

@davidfowl
Copy link
Member

No idea, I don't think anybody debugged it.

@danroth27 danroth27 added this to the 6.0.0-beta5 milestone Apr 8, 2015
@danroth27
Copy link
Member

@pranavkm Please investigate why these files are being watched.

@adriaanp
Copy link
Author

Just another note loading a view takes a considerable amount of time on first load, but not for actions that returns json.

@martinalderson
Copy link

This is still an issue for me, I have to export for it to load ok.

@dougbu
Copy link
Contributor

dougbu commented Jun 8, 2015

@martinalderson when you say ("I have to export") do you mean the known export MONO_MANAGED_WATCHER=false workaround?

Are you seeing any issues with that workaround in place?

@martinalderson
Copy link

Yes. It means I have to restart the server (it can't watch for file changes).

Mono core bug: https://bugzilla.xamarin.com/show_bug.cgi?id=28693

They are looking for better repro, though doing some more digging looks like 4.1.0 will fix it.

@Eilon Eilon modified the milestones: 6.0.0-beta6, 6.0.0-beta7 Jul 1, 2015
@danroth27 danroth27 assigned sornaks and unassigned pranavkm Jul 7, 2015
@danroth27 danroth27 modified the milestones: 6.0.0-beta6, 6.0.0-beta7 Jul 7, 2015
@danroth27
Copy link
Member

@sornaks Could you please work to create a better repro for this Mono issue and add it to the bugzilla issue?: https://bugzilla.xamarin.com/show_bug.cgi?id=28693

@jasoncavett
Copy link

Seeing the same issue as @adriaanp. Everything will run fine until I perform npm install. Once that has completed, I receive the same exact error when I attempt to run dnx . kestrel.

@danroth27 danroth27 added this to the 6.0.0-beta7 milestone Jul 16, 2015
@danroth27 danroth27 removed this from the 6.0.0-beta6 milestone Jul 16, 2015
@jasoncavett
Copy link

@danroth27 I added some additional reproduction information to Issue 508 on the aspnet project.

@sornaks
Copy link

sornaks commented Aug 11, 2015

This is tracked as an external issue here - https://github.com/aspnet/External/issues/2. So closing this.

@martinalderson
Copy link

That page 404s for me. Is this solved in Mono 4.2?

@martinalderson
Copy link

So, looks like it is fixed in Mono 4.2.0 from homebrew on OS X. I can now make changes .cshtml files and refresh the browser and changes immediately appear.

However, changing .cs files requires a full restart of the kestrel server. I thought it would automatically watch files and rebuild in ASP.NET5?

@danroth27
Copy link
Member

Kestrel doesn't auto restart at this point. Currently auto restart is just supported in VS.

@martinalderson
Copy link

Is there a timescale for that support in Kestrel?

@richardtallent
Copy link

Not sure why this is marked closed, it is definitely still an issue. I'm using:

VS Code 0.10.1 (latest)
Mono 4.2.1.102 (latest, installed via brew)
DNX 1.0.0-rc1-16202 (latest, according to dnvm)
OS X 10.11 (latest, though it shouldn't matter)

I created a new web site using "yo aspnet" (MVC, no identity/auth) and dnx ran perfectly.

Then I installed the ESLint extension ("npm install eslint" from my workspace folder). This created a new "node_modules" folder with over 2800 files. Since then, dnx throws the "kqueue() FileSystemWatcher has reached the maximum number of files to watch" exception on every request.

The MONO_MANAGED_WATCHER workaround did fix it, but of course broke my ability to quickly edit and reload.

@henkmollema
Copy link
Contributor

Having this issue too with dnx-mono.1.0.0-rc1-update1 and Mono 4.0.4.

The export MONO_MANAGED_WATCHER=false workaround works though.

/cc @davidfowl

@rtncdevs
Copy link

rtncdevs commented Dec 9, 2015

Having the same issue using Mono 4.2.1 and dnx-mono-1.0.0-rc1-update1

Export env variable makes it work.

@tonerdo
Copy link

tonerdo commented Dec 21, 2015

The export MONO_MANAGED_WATCHER=false workaround worked perfectly for me.

/cc @davidfowl

@danludwig
Copy link

Definitely still an issue with mono 4.2.1 as the workaround is needed with that version.

@anderssonjohan
Copy link

Mono 4.2.1 still has this issue, that's for sure.

$ mono -V
Mono JIT compiler version 4.2.1 (explicit/6dd2d0d Tue Nov 10 18:01:18 EST 2015)

I just downloaded the latest mdk alpha from the Mono download archive and the issue is now gone!

$ mono -V
Mono JIT compiler version 4.2.2 (explicit/996df3c Wed Jan 20 00:19:48 EST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug
    LLVM:          yes(3.6.0svn-mono-(detached/a173357)
    GC:            sgen

Output from dnx-watch --version

[DnxWatcher] info: dnx process id: 3541
Microsoft .NET Execution environment
 Version:      1.0.0-rc1-16231
 Type:         Mono
 Architecture: x64
 OS Name:      Darwin
 OS Version:   10.11
 Runtime Id:   osx.10.11-x64

@0lorak0
Copy link

0lorak0 commented Feb 10, 2016

@anderssonjohan I updated mono using the latest mdk alpha package and that fixed it for me as well. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests