-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
CreateAppHost fails on file systems that cannot mmap with MAP_SHARED #35628
Comments
@peterhuene can you take a look when you have a chance? |
Hi @loop-evgeny. Thanks for reporting this to us. It appears that a non-modified apphost executable got copied to your publish output somehow. The I'll investigate and report back with my findings. |
@loop-evgeny I'm unable to reproduce this with SDK Could you share with me your exact repro steps and the The steps I took to reproduce:
The output was the expected I was also unable to reproduce it with a 2.2 SDK targeting Thanks! |
OK, so the repro is a little more complicated! I actually have 2 Linux VM on my Windows host: a Linux Mint 19 one with the .NET Core SDK installed and an Ubuntu 18.04 one, without .NET Core installed. The Windows host also has .NET Core SDK installed. (dotnet --info for both attached.) I initially tried to publish on the Mint VM, got an error, re-ran the same command and it appeared to work:
( However, when I ran the output I got the error in the original issue. I then tried to publish on the Windows host:
This appears to succeed, but the resulting executable gives the same error (even though I'm publishing to a different directory!) Even if I run So it seems like there is a number of bugs here:
|
Hi @loop-evgeny. Thanks for the detailed information. It looks like the Do you know how From the .NET Core Framework sources, it is using We might be able to fix this by either asking the framework to support specifying whether or not we want a private mapping; I can also investigate alternative methods to mapping the file since the original apphost file is not very big. Regardless of that fix, the SDK should be deleting the output file in You should be able to work around the issue for now by deleting |
|
Looks like the same root cause though: |
@jwrdegoede out of curiosity regarding your work of supporting |
Seems like it would be safer to just use regular file access - as you say, there will be other filesystems that don't support memory-mapped files, even if vboxsf eventually does. |
That will likely be my fix if I have to make one. There aren't that many reads we have to do to search through the file to find what we're looking for, so any performance benefit of memory mapping the file is likely negligible, even if mapping the file does reduce the complexity of the search code since it can just treat it as linear memory. |
I'm working on getting a cleaned up version of vboxsf into the mainline linux kernel and that version will have the commit you point to. This project has been on halt for a while, but I actually hope to resume work on it soonish. |
@jwrdegoede thanks for following up to my random question! I look forward to seeing it in mainline. |
Side note: the original code did readallbytes/search and replace/writeallbytes. Memory map was just the straight forward way to stop putting several hundred KB on LOH. I argued to the original implementers of the feature that the apphost should come with a descriptor that says where the offset is, and we could just seek to it, but they felt this was too much trouble. |
This commit deletes the output apphost when the `CreateAppHost` task fails from an exception. Partially fixes #2989.
This commit deletes the output apphost when the `CreateAppHost` task fails from an exception. Partially fixes #2989.
This commit deletes the output apphost when the `CreateAppHost` task fails from an exception. Partially fixes #2989.
Re-opening as dotnet/sdk#3427 only fixed part of the issue: deleting the output apphost upon failure so it isn't left in a semi-customized state. |
@livarcocc can I get a bar check on this? I think to properly address this issue we would have to stop using memory mapped I/O in the Both seem like pretty risky changes for 3.0 P9. This affects users that are building on a filesystem that can't support shared memory mapped I/O. |
https://github.com/dotnet/core-setup/issues/8764 tracks having the apphost pack supply the offset so that the SDK won't need to search at all. This would fix this and be more efficient. |
Updated title per @swaroop-sridhar request |
I had already renamed it. I think my title is more accurate so I renamed it back while keeping CreateAppHost. This is not limited to scenarios involving mapping a windows drive, it can be on any file system on unix that does not allow MAP_SHARED. I do think https://github.com/dotnet/core-setup/issues/8764 is the best solution. |
Is this fixed already? I can't run a hello world dotnet new webapi with this error, using vagrant with ubuntu... any way to solve this at all? "error MSB4018: The "CreateAppHost" task failed unexpectedly." |
…0190927.25 (#2989) - Microsoft.NETCore.App - 5.0.0-alpha1.19477.25 Dependency coherency updates - System.CodeDom - 5.0.0-alpha1.19477.7 (parent: Microsoft.NETCore.App) - System.Security.Cryptography.ProtectedData - 5.0.0-alpha1.19477.7 (parent: Microsoft.NETCore.App) - System.Text.Encoding.CodePages - 5.0.0-alpha1.19477.7 (parent: Microsoft.NETCore.App)
I'm still seeing these issues as of NET Core 3.1.201 inside of Virtual Box's synced folders. On the guest OS inside of a synced folder, I run Update: I updated VirtualBox from |
I get same error with: And I'm running on host macOS and ubuntu 18.04 as guest. |
Any solution/update for this? as on Linux 19.10 issue still exists. |
Adding @dsplaisted as neither Peter nor I work on this project anymore. |
I couldn't figure out the best area label to add to this issue. Please help me learn by adding exactly one area label. |
@swaroop-sridhar @jeffschwMSFT We think this would be a fix to the CreateAppHost code which lives in the runtime repo. So I've moved it to dotnet/runtime. Please triage. Thanks! |
Tagging subscribers to this area: @vitek-karas, @swaroop-sridhar |
Sure @dsplaisted. |
Why does it depend on that (providing the offset)? Can't the search and replace still be done using normal file read/write APIs (instead of a memory-mapped file)? |
@loop-evgeny "depends" was probably too strong a constraint. , |
This should be fixed as we no longer use MAP_SHARED to write the apphost |
I created a new console application in VS 2017 using .NET Core 2.1. Published it as a self-contained linux-x64 app without any changes and tried to run it on an Ubuntu 18.04 VM. Got this error:
c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 is apparently the SHA256 hash of "foobar", so whatever the real problem is, this is a very weird error message, too!
LinuxTest.csproj:
Program.cs:
Resulting self-contained binary: LinuxTest.zip
If I install dotnet-runtime-2.1 on the Linux VM and run
dotnet LinuxTest.dll
it works.The text was updated successfully, but these errors were encountered: