dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
8.91k stars 1.86k forks source link

Directory permission exception with multiple concurrent users on linux #7172

Open ErikApption opened 2 weeks ago

ErikApption commented 2 weeks ago

System Information (please complete the following information):

Describe the bug

When multiple users are running ML.NET on the same server. each process seems to require a temporary directory - however its name is hardcoded and the second user running ml.net will fail because /tmp/ml_dotnet is not accessible.

2024-06-08 20:00:31.5387|FATAL|Datahunter.Core.Helpers.MLHelper|Error initializing ML Model System.UnauthorizedAccessException: Access to the path '/tmp/ml_dotnet/hetgfm5v.kvn' is denied.
 ---> System.IO.IOException: Permission denied
   --- End of inner exception stack trace ---
   at System.IO.FileSystem.CreateDirectory(String fullPath, UnixFileMode unixCreateMode)
   at System.IO.Directory.CreateDirectory(String path)
   at Microsoft.ML.Repository.GetShortTempDir(IExceptionContext ectx)
   at Microsoft.ML.Repository..ctor(Boolean needDir, IExceptionContext ectx)
   at Microsoft.ML.RepositoryReader..ctor(Stream stream, IExceptionContext ectx, Boolean useFileSystem)
   at Microsoft.ML.RepositoryReader.Open(Stream stream, IExceptionContext ectx, Boolean useFileSystem)
   at Microsoft.ML.ModelOperationsCatalog.Load(Stream stream, DataViewSchema& inputSchema)

To Reproduce Steps to reproduce the behavior:

  1. Launch one process with user one
  2. Launch same process with user two
  3. User two will get an IOException

Expected behavior Temporary directory should be unique for each user

ErikApption commented 1 week ago

If anyone else is having this issue, you can configure TMPDIR as workaround