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

watch : Exited with error code 139 watch : Waiting for a file to change before restarting dotnet... #7112

Open
Kwofie-mex opened this issue Jan 13, 2022 · 19 comments
Labels
area-tutorials Issues related to getting started tutorials

Comments

@Kwofie-mex
Copy link

Problem encountered on https://dotnet.microsoft.com/en-us/learn/aspnet/blazor-tutorial/run
Operating System: linux

Provide details about the problem you're experiencing. Include your operating system version, exact error message, code sample, and anything else that is relevant.

@mairaw
Copy link
Contributor

mairaw commented Jan 13, 2022

@danroth27 can you assist with this?

@mairaw mairaw added the area-tutorials Issues related to getting started tutorials label Jan 13, 2022
@danroth27
Copy link
Member

Hmm...not sure. @pranavkm ?

@pranavkm
Copy link
Contributor

139 usually means access violation. Is this error consistent? Do you get this running other dotnet commands?

@rosgori
Copy link

rosgori commented Feb 7, 2022

Yes! This is a little bit worrying. This happens when I want to run a small project in .NET 6 or .NET 5. This message is:

watch : Started

watch : Exited with error code 139
watch : Waiting for a file to change before restarting dotnet...

And that appears when I use the command dotnet watch run or dotnet run. Also when I try to run from the folder bin/Debug/My-project, another message appears: Violación de segmento ('core' generado), which translates to English (if I am not mistaken) as Core Dump (Segmentation fault). I don't know why this happens and I cannot use .NET in my machine.

Some info:

  • Operating system: Ubuntu 20.04 with kernel 5.13.0-28-generic.
  • This happens with dotnet version 6.0.101 and the last from .NET 5 (I think it is 5.0.404).
  • When I press Ctrl + C, it shows:
Long message
Unhandled exception. System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at System.Threading.CancellationToken.ThrowIfCancellationRequested()
   at Microsoft.CodeAnalysis.EditAndContinue.CommittedSolution.<>c__DisplayClass15_0.<<GetMatchingDocumentsAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.CodeAnalysis.EditAndContinue.CommittedSolution.GetMatchingDocumentsAsync(IEnumerable`1 documentsByProject, Func`2 compilationOutputsProvider, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.EditAndContinue.EditAndContinueWorkspaceService.StartDebuggingSessionAsync(Solution solution, IManagedHotReloadService debuggerService, ImmutableArray`1 captureMatchingDocuments, Boolean captureAllMatchingDocuments, Boolean reportDiagnostics, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.ExternalAccess.Watch.Api.WatchHotReloadService.StartSessionAsync(Solution solution, CancellationToken cancellationToken)
   at Microsoft.DotNet.Watcher.Tools.CompilationWorkspaceProvider.CreateProject(TaskCompletionSource`1 taskCompletionSource, Task`1 hotReloadCapabilitiesTask, String projectPath, IReporter reporter, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()

@rosgori
Copy link

rosgori commented Feb 8, 2022

Same problem with dotnet version 6.0.102.

@danroth27
Copy link
Member

Is it possible you're building from/to a protected directory?

@rosgori
Copy link

rosgori commented Feb 9, 2022

The solution is weird, I don't know why. I have installed dotnet through snap and it was working fine, no problem there. Suddenly on February when I tried to run some projects, it didn't work, it showed watch : Exited with error code 139. I tried two possible solutions: the first one, I downloaded the binaries from here and I used the executable (for the versions 5 and 6). Same error. The second solution was to install from apt (I am using Ubuntu) using this guide. It worked!. Again, I don't know why, but I can run any project using dotnet run or dotnet watch run. Although this does not answer the question: why did that kind of error show up?

@mot256
Copy link

mot256 commented Mar 2, 2022

We were debugging an issue where our .NET containers (linux) sometimes exit with 139 errors and I later found that if the .NET app (which runs as the entrypoint to the container) throws an unhandled exception (same as in @rosgori's comment), then the container consistently has an exit code of 139.
What is even more confusing is that if you shell into the same container and run the "dotnet my-app.dll" manually you get an exit code of 134 (Abort) when an unhandled exception is thrown. You can simulate this with any .NET app (from 3.1 to 6.0) where you simply throw an exception in the Main method.

@bijeaylimbu
Copy link

#7112 (comment) thanks your solutions works

@omajid
Copy link
Member

omajid commented Oct 17, 2022

We are trying to fix our docs to warn people about snap being mostly broken for dotnet tools: dotnet/docs#31045

@Sidjay00
Copy link

The solution is weird, I don't know why. I have installed dotnet through snap and it was working fine, no problem there. Suddenly on February when I tried to run some projects, it didn't work, it showed watch : Exited with error code 139. I tried two possible solutions: the first one, I downloaded the binaries from here and I used the executable (for the versions 5 and 6). Same error. The second solution was to install from apt (I am using Ubuntu) using this guide. It worked!. Again, I don't know why, but I can run any project using dotnet run or dotnet watch run. Although this does not answer the question: why did that kind of error show up?

Thank you so much! The 2nd solution did helped me.

@nandafirmans
Copy link

nandafirmans commented Dec 1, 2023

I'm getting the same issue on archlinux, I'm using dotnet 6.0 I had no clue why this happen, I already try install manually, by script dotnet-install.sh and also from aur package dotnet-sdk-6.0

dotnet watch ❌ Exited with error code 139
dotnet watch ⏳ Waiting for a file to change before restarting dotnet...```

@danroth27
Copy link
Member

@nandafirmans I don't do much on Linux, but it doesn't look like archlinux is currently on the supported distro list for .NET 8: https://github.com/dotnet/core/blob/main/release-notes/8.0/supported-os.md.

@richlander Do you know if there are known issues running .NET on archlinux?

@diegodfsd
Copy link

Does anyone have updates regarding this issue? We are currently using .NET Core SDK 7 (mcr.microsoft.com/dotnet/sdk:7.0) on Amazon Elastic Container Service (ECS). For several weeks now, we have been encountering these errors where the container is abruptly terminated with exit code 139. Unfortunately, there is no additional information provided to help us comprehend the root cause of the error.

@arhue
Copy link

arhue commented Jan 13, 2024

Facing the same issue as @diegodfsd above. Tried Ubuntu amd64 and Alpine amd64 docker image. Same issue. Host OS is Ubuntu. Nothing in logs. Seems more easily triggered on Ubuntu vs Alpine, which takes longer. Tried debugging it for weeks now.

@huzaynbolt
Copy link

@arhue / @diegodfsd Do you have fix to this issue yet? It's being a bottle neck for one of my service with similar setup on ECS

@diegodfsd
Copy link

Hi @huzaynbolt we solved our problem. In our case, the cause behind the abruptly terminated ECS Tasks was the usage of the IronPdf library that uses chromium, but after we made the library upgrade the issue was fixed.

@huzaynbolt
Copy link

How do your debug on ECS then? That's my struggle at the moment. Since ECS terminated the task upon the error and I can't retrieve the logs after it stopped

@arhue
Copy link

arhue commented Aug 22, 2024

@huzaynbolt Sorry about the delay, missed the notification. Yes, for us it was because application was running out of memory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-tutorials Issues related to getting started tutorials
Projects
None yet
Development

No branches or pull requests