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

File already exists error when loading LightGbmBinaryTrainer from MemoryStream #5210

Closed
dasokolo opened this issue Jun 4, 2020 · 7 comments
Assignees
Labels
P1 Priority of the issue for triage purpose: Needs to be fixed soon.

Comments

@dasokolo
Copy link

dasokolo commented Jun 4, 2020

System information

os version Windows (not sure)
.net version 3.1.202
mlnet version 1.3.1

Issue

I am loading LightGbmBinaryTrainer from memory stream

            ITransformer model = null;
            using (MemoryStream ms = new MemoryStream(kv.Value))
            {
                model = _mLContext.Model.Load(ms, out _inputSchema);
            }

Note, this code is executed in several threads in parallel over the same model.

And I occasionally get the following exception:

System.IO.IOException: The file 'D:\SvcFab_App\AIBuilder.Platform.Host_App157\temp\TLC_1CBA6C2E\0' already exists.

This happens occasionally and I can't reliably reproduce this 100%.

  • What did you expect?
  1. I expected that no file operations are performed during loading from memory stream. My models are relatively small, but I can't guarantee that the filesystem is always available. I would appreciate to at least have some control over this behavior.

  2. But if file operations cannot be avoided, I expect to have no naming conflicts.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.IOException: The file 'D:\SvcFab_App\AIBuilder.Platform.Host_App157\temp\TLC_1CBA6C2E\0' already exists.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.Compression.ZipFileExtensions.ExtractToFile(ZipArchiveEntry source, String destinationFileName, Boolean overwrite)
at Microsoft.ML.RepositoryReader.OpenEntryOrNull(String dir, String name)
at Microsoft.ML.ModelOperationsCatalog.Load(Stream stream, DataViewSchema& inputSchema)

@Lynx1820 Lynx1820 added the P1 Priority of the issue for triage purpose: Needs to be fixed soon. label Jun 5, 2020
@frank-dong-ms-zz
Copy link
Contributor

@dasokolo could you please provide a repro project and necessary dataset so we can investigate further? BTW, are you working on latest version of ML.NET (1.5.0)?

@frank-dong-ms-zz frank-dong-ms-zz added the need info This issue needs more info before triage label Jun 10, 2020
@frank-dong-ms-zz frank-dong-ms-zz self-assigned this Jun 10, 2020
@dasokolo
Copy link
Author

dasokolo commented Jun 10, 2020 via email

@dasokolo
Copy link
Author

Is there a way to make File IO functionality configurable and only use memory?

@frank-dong-ms-zz
Copy link
Contributor

frank-dong-ms-zz commented Jun 10, 2020

@dasokolo I can't repro the issue with provided code piece as well. Regarding the question, I believe the answer is no but let me check code and get back to you later, thanks.

@frank-dong-ms-zz
Copy link
Contributor

@dasokolo I have checked the code, currently there is no option that can user can set to avoid file operation when load model. I already open a PR to fix the issue you met.

@frank-dong-ms-zz
Copy link
Contributor

This issue should already fixed at below PR:
#4645

please upgrade to latest version of ml.net.

@frank-dong-ms-zz frank-dong-ms-zz removed the need info This issue needs more info before triage label Jun 11, 2020
@frank-dong-ms-zz
Copy link
Contributor

Close this issue now as this already fixed, feel free to reopen if necessary, thanks

@ghost ghost locked as resolved and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Priority of the issue for triage purpose: Needs to be fixed soon.
Projects
None yet
Development

No branches or pull requests

3 participants