imazen / imageflow-dotnet-server

A super-fast image server to speed up your site - deploy as a microservice, serverless, or embeddable.
https://docs.imageflow.io
GNU Affero General Public License v3.0
246 stars 33 forks source link

Error while copying a Website: files in /App_Data/imageflow_hybrid_cache/...metastore are inaccessible #68

Closed BeniFreitag closed 1 year ago

BeniFreitag commented 1 year ago

We have automated processes to copy an entire web-application, used for testing/staging and upgrade purposes. Every time we get the following error about a .metastore file:

ERROR 32 (0x00000020) Copying File .../App_Data/imageflow_hybrid_cache/db/6/00000046090720481062.metastore
The process cannot access the file because it is being used by another process.

How can we solve this? Is there some file open (unintentionally) left open? Can we skip these .metastore files or would that have a downside?

lilith commented 1 year ago

The .metastore files are the write-ahead-logs, and they remain open until the process ends. If the process is killed they may be left open. The cache should not be located inside the web app, and you shouldn't be deploying it.

iJungleboy commented 1 year ago

@tvatavuk pls monitor this too

@lilith I don't quite understand, maybe you can help clarify this...

ATM it's just in the web-root, so as we copy the site using powershell or robocopy, it tries to copy this too.

Do you mean...

  1. It should be outside of the web folder? That would make it difficult for many hosting scenarios...
  2. We should ignore the files when we copy the website?
  3. Should we trigger a process-stop before copying?
  4. or are we missing something?

Thank you so much!

lilith commented 1 year ago

It's important the cache folder never be accessible over http. Putting it outside the web root solves this issue and others (such as issues with file change monitors).

It should never be copied or deployed, either.

On Fri, Sep 30, 2022, 3:51 AM iJungleboy @.***> wrote:

@tvatavuk https://github.com/tvatavuk pls monitor this too

@lilith https://github.com/lilith I don't quite understand, maybe you can help clarify this...

ATM it's just in the web-root, so as we copy the site using powershell or robocopy, it tries to copy this too.

Do you mean...

  1. It should be outside of the web folder? That would make it difficult for many hosting scenarios...
  2. We should ignore the files when we copy the website?
  3. Should we trigger a process-stop before copying?
  4. or are we missing something?

Thank you so much!

— Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow-dotnet-server/issues/68#issuecomment-1263357553, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LH36PPKHINBPUNJM66TWA2ZZDANCNFSM6AAAAAAQKSSJXM . You are receiving this because you were mentioned.Message ID: @.***>

iJungleboy commented 1 year ago

@lilith thanks for these infos

Note that since it's in the /App_Data/ it's at least not accessible over http.

Question: If we copy the site to another folder and include the cache folder without the .metastore files, will the cached files still be used, or will they be recreated? Because in that case we would of course not copy the cache at all.

Moving outside of root not possible

Placing it outside of the web root is not possible in our case (the CMS DNN) since it would require security reconfiguration. Most DNN installations are hardened that no file access outside of the /Website/ folder is possible. So making this necessary would be a show stopper.

What setup do others use, especially other people who include it as a plugin for something which restricts such options as folder placement?

Thanks ;)

lilith commented 1 year ago

Definitely don't copy files without the .metastore, they will become orphaned and never removed.

I would not copy the folder at all.

As long as you are correctly managing file permissions, accessibility, and the file watcher issues in IIS, it should be fine to use App_Data.

On Fri, Sep 30, 2022, 5:14 AM iJungleboy @.***> wrote:

@lilith https://github.com/lilith thanks for these infos

Note that since it's in the /App_Data/ it's at least not accessible over http.

Question: If we copy the site to another folder and include the cache folder without the .metastore files, will the cached files still be used, or will they be recreated? Because in that case we would of course not copy the cache at all.

Moving outside of root not possible

Placing it outside of the web root is not possible in our case (the CMS DNN) since it would require security reconfiguration. Most DNN installations are hardened that no file access outside of the /Website/ folder is possible. So making this necessary would be a show stopper.

What setup do others use, especially other people who include it as a plugin for something which restricts such options as folder placement?

Thanks ;)

— Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow-dotnet-server/issues/68#issuecomment-1263442757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LHYYEA5HAMDN4KUKO6LWA3DSTANCNFSM6AAAAAAQKSSJXM . You are receiving this because you were mentioned.Message ID: @.***>

iJungleboy commented 1 year ago

thanks. Then let's close this issue ;)

BeniFreitag commented 1 year ago

Thanks. We'll skip that folder in the future.