linuxserver / docker-radarr

GNU General Public License v3.0
640 stars 103 forks source link

"Failed to import movie" due to file "being used by another process" #142

Closed MattKobayashi closed 3 years ago

MattKobayashi commented 3 years ago

linuxserver.io


Expected Behavior

Movies should import successfully

Current Behavior

Movies fail to import, logs show the following error: [v3.1.1.4954] System.IO.IOException: The process cannot access the file because it is being used by another process.

Steps to Reproduce

  1. Attempt to import a downloaded movie file.
  2. Import will fail with the above error message.

Environment

OS: BurmillaOS v1.9.1 CPU architecture: x86_64 How docker service was installed: From the official Docker Hub repo via a docker-compose script.

Command used to create docker container (run/create/compose/screenshot)

From .env file: STORAGE_DIR=/mnt/storage

From docker-compose.yaml:

version: "3.8"
services:
  radarr:
    container_name: radarr
    image: "linuxserver/radarr:latest"
    restart: unless-stopped
    depends_on:
      - sabnzbd
      - qbittorrent
    ports:
      - target: 7878
        published: 7878
        protocol: tcp
        mode: host
    environment:
      - PUID=1100
      - PGID=1100
      - TZ=Australia/Brisbane
    volumes:
      - type: bind
        source: ${STORAGE_DIR}/media/movies
        target: /movies
      - type: bind
        source: ${STORAGE_DIR}/downloads
        target: /downloads
      - type: volume
        source: radarr_data
        target: /config
    networks:
      - server
    labels:
      - "traefik.http.routers.radarr.rule=Host(`<removed>`)"
      - "traefik.http.routers.radarr.tls=true"
      - "traefik.http.routers.radarr.tls.certresolver=letsencrypt"
      - "traefik.http.routers.radarr.middlewares=authelia@docker"
      - "traefik.http.services.radarr.loadbalancer.server.port=7878"
volumes:
  radarr_data:
    name: radarr_data

Docker logs

Too large to attach here, but the relevant snippet is:

radarr         | [Warn] ImportApprovedMovie: Couldn't import movie /downloads/movies/D3.The.Mighty.Ducks.1996.1080p.BluRay.x265.FreetheFish/a2dd972e969b49f3a8eebb5cc9dc4b1e.mkv 
radarr         | 
radarr         | [v3.1.1.4954] System.IO.IOException: The process cannot access the file because it is being used by another process.
radarr         |    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
radarr         |    at Interop.CheckIo(Int64 result, String path, Boolean isDirectory, Func`2 errorRewriter)
radarr         |    at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
radarr         |    at System.IO.FileSystem.LinkOrCopyFile(String sourceFullPath, String destFullPath)
radarr         |    at System.IO.FileSystem.MoveFile(String sourceFullPath, String destFullPath, Boolean overwrite)
radarr         |    at System.IO.File.Move(String sourceFileName, String destFileName, Boolean overwrite)
radarr         |    at NzbDrone.Mono.Disk.DiskProvider.TransferFilePatched(String source, String destination, Boolean overwrite, Boolean move) in D:\a\1\s\src\NzbDrone.Mono\Disk\DiskProvider.cs:line 333
radarr         |    at NzbDrone.Common.Disk.DiskProviderBase.MoveFile(String source, String destination, Boolean overwrite) in D:\a\1\s\src\NzbDrone.Common\Disk\DiskProviderBase.cs:line 245
radarr         |    at NzbDrone.Common.Disk.DiskTransferService.TryMoveFileVerified(String sourcePath, String targetPath, Int64 originalSize) in D:\a\1\s\src\NzbDrone.Common\Disk\DiskTransferService.cs:line 506
radarr         |    at NzbDrone.Common.Disk.DiskTransferService.TransferFile(String sourcePath, String targetPath, TransferMode mode, Boolean overwrite) in D:\a\1\s\src\NzbDrone.Common\Disk\DiskTransferService.cs:line 296
radarr         |    at NzbDrone.Core.MediaFiles.MovieFileMovingService.TransferFile(MovieFile movieFile, Movie movie, String destinationFilePath, TransferMode mode) in D:\a\1\s\src\NzbDrone.Core\MediaFiles\MovieFileMovingService.cs:line 134
radarr         |    at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeMovieFile(MovieFile movieFile, LocalMovie localMovie, Boolean copyOnly) in D:\a\1\s\src\NzbDrone.Core\MediaFiles\UpgradeMediaFileService.cs:line 51
radarr         |    at NzbDrone.Core.MediaFiles.MovieImport.ImportApprovedMovie.Import(List`1 decisions, Boolean newDownload, DownloadClientItem downloadClientItem, ImportMode importMode) in D:\a\1\s\src\NzbDrone.Core\MediaFiles\MovieImport\ImportApprovedMovie.cs:line 123
radarr         | 
radarr         | 
github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

Roxedus commented 3 years ago

Have you reached out to the radarr team? This sounds like a quirk on their side.

MattKobayashi commented 3 years ago

Yes, I have. Turns out the issue is .NET Core not liking crossing filesystems (or, in my case, ZFS datasets). I had to shuffle my media library around so that everything (downloads folder, media library, etc.) was all on the same ZFS dataset. It does seem to be working properly now, although I question why it was an issue in the first place. Seems like a pretty nasty bug to me. Anyway, thanks for the response @Roxedus, I'll close this one off.