dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.75k stars 1.07k forks source link

Issue with Disappearing Libraries in Self-Standing .NET Executible on Linux #16412

Open joyceew opened 3 years ago

joyceew commented 3 years ago

This is somewhat related to ticket 4085 - the same directory is involved, but a different issue. From that ticket: When running a single exe packaged .Net Core app on Linux, it will first expand itself to a sub directory under /var/tmp/.net . If /var/tmp/.net does not exist, the directory /var/tmp/.net is created.

My issue: My app is expanded into a directory called /var/tmp/.net/EndotoxinDataRequest\fhwc5bju.he1. This directory contains all the .NET libraries/dependencies. I run the app as a cron job, once/week. It will run fine for several weeks, then fail because it's missing a dependency. When it fails, if I go into that directory I can see that several of the libraries are missing. To make it run successfully, all I have to do is remove the directory. Then when I re-run the executible, it expands again, creates the directory and all the dependencies. It then runs successfully.

Why are the libraries disappearing? How can I prevent this? I've tried adjusting permissions and locking it down, but still...eventually, the app will fail because a dependency is missing.

Any insight as to how to resolve this would be appreciated! Thanks!

dotnet-issue-labeler[bot] commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

marcpopMSFT commented 3 years ago

Any chance you have another job that's monitoring the tmp folder and cleaning it out periodically? Could you try moving your app to a different location to see if it still happens there? This doesn't seem like an sdk issue.

joyceew commented 3 years ago

Thanks for your reply – I believe I did get this resolved. The 2 links below helped me get it. Apparently, the tmp directory is the default extraction location, and there is some sort of auto-cleanup that occurs there. To get around it, you have to change the default location to a directory of your choice by setting an environment variable. The one I ended up having to set is referenced in the 3778 solution, DOTNET_BUNDLE_EXTRACT_BASE_DIR. Been running for a week with no issues. I think this was the solution. Thanks! Joyce

https://github.com/dotnet/runtime/issues/3846

https://github.com/dotnet/runtime/issues/3778

From: Marc Paine @.> Reply-To: dotnet/sdk @.> Date: Wednesday, March 31, 2021 at 5:28 PM To: dotnet/sdk @.> Cc: "White, Joyce" @.>, Author @.***> Subject: [External] Re: [dotnet/sdk] Issue with Disappearing Libraries in Self-Standing .NET Executible on Linux (#16412)


Cook Information Security Warning: This message came from an external source. Please exercise caution when opening any attachments or clicking on links.


Any chance you have another job that's monitoring the tmp folder and cleaning it out periodically? Could you try moving your app to a different location to see if it still happens there? This doesn't seem like an sdk issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/dotnet/sdk/issues/16412*issuecomment-811477515__;Iw!!A8obM_XI3-KO!TOkiFCQ72htZY6tAMK79sHTbEYqqMAGDN5XGDpcmNTiJidS3F04y3P9JC-Z5hF_KqRVY7MQ$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ATJHCDVEH2OPVMSRJUTEA53TGOHX7ANCNFSM4ZMTLHHA__;!!A8obM_XI3-KO!TOkiFCQ72htZY6tAMK79sHTbEYqqMAGDN5XGDpcmNTiJidS3F04y3P9JC-Z5hF_Kv_Q4_nk$.