{"action":"created","issue":{"url":"https://api.github.com/repos/Sonarr/Sonarr/issues/1505","repository_url":"https://api.github.com/repos/Sonarr/Sonarr","labels_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/1505/labels{/name}","comments_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/1505/comments","events_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/1505/events","html_url":"https://github.com/Sonarr/Sonarr/issues/1505","id":182245008,"node_id":"MDU6SXNzdWUxODIyNDUwMDg=","number":1505,"title":"Sonarr continuously rewrites episodes when importing with incorrect permissions.","user":{"login":"DominicMe","id":2036768,"node_id":"MDQ6VXNlcjIwMzY3Njg=","avatar_url":"https://avatars2.githubusercontent.com/u/2036768?v=4","gravatar_id":"","url":"https://api.github.com/users/DominicMe","html_url":"https://github.com/DominicMe","followers_url":"https://api.github.com/users/DominicMe/followers","following_url":"https://api.github.com/users/DominicMe/following{/other_user}","gists_url":"https://api.github.com/users/DominicMe/gists{/gist_id}","starred_url":"https://api.github.com/users/DominicMe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DominicMe/subscriptions","organizations_url":"https://api.github.com/users/DominicMe/orgs","repos_url":"https://api.github.com/users/DominicMe/repos","events_url":"https://api.github.com/users/DominicMe/events{/privacy}","received_events_url":"https://api.github.com/users/DominicMe/received_events","type":"User","site_admin":false},"labels":[{"id":209639528,"node_id":"MDU6TGFiZWwyMDk2Mzk1Mjg=","url":"https://api.github.com/repos/Sonarr/Sonarr/labels/bug","name":"bug","color":"e11d21","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-10-11T11:58:51Z","updated_at":"2018-12-09T10:02:31Z","closed_at":null,"author_association":"NONE","body":"I noticed a pretty serious issue with Sonarr where it seems to continuously copy episodes and then repeat again and again when importing. When one episode is finished copying it is removed and either a different or same episode starts copying again. This can kill an SSD in a matter of weeks if not less.\n\nThis happens when episodes are in drone factory folder or when manually importing from same folder. The permissions of the episodes are insufficient and when fixed it imports just fine. Problem is that Sonarr should not be deleting the episodes once they have been copied just because it cannot delete the episodes in drone factory and certainly should not repeat this over and over.\n\nThe following message is printed in the logs for each attempted import and no other messages are present.\n\nMessage:\n\n`Couldn't import episode /mnt/downloads/series/[folder]/[file]: Access to the path is denied.`\n\nException:\n\n```\nSystem.UnauthorizedAccessException: Access to the path is denied.\n  at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00140] in <dca3b561b8ad4f9fb10141d81b39ff45>:0 \n  at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination, System.Boolean overwrite) [0x000e3] in <4f799f5bb7104eb690bf5945746e79cf>:0 \n  at NzbDrone.Common.Disk.DiskTransferService.TryMoveFileVerified (System.String sourcePath, System.String targetPath, System.Int64 originalSize) [0x00000] in <4f799f5bb7104eb690bf5945746e79cf>:0 \n```\n"},"comment":{"url":"https://api.github.com/repos/Sonarr/Sonarr/issues/comments/445524551","html_url":"https://github.com/Sonarr/Sonarr/issues/1505#issuecomment-445524551","issue_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/1505","id":445524551,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTUyNDU1MQ==","user":{"login":"flatrick","id":5464311,"node_id":"MDQ6VXNlcjU0NjQzMTE=","avatar_url":"https://avatars3.githubusercontent.com/u/5464311?v=4","gravatar_id":"","url":"https://api.github.com/users/flatrick","html_url":"https://github.com/flatrick","followers_url":"https://api.github.com/users/flatrick/followers","following_url":"https://api.github.com/users/flatrick/following{/other_user}","gists_url":"https://api.github.com/users/flatrick/gists{/gist_id}","starred_url":"https://api.github.com/users/flatrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flatrick/subscriptions","organizations_url":"https://api.github.com/users/flatrick/orgs","repos_url":"https://api.github.com/users/flatrick/repos","events_url":"https://api.github.com/users/flatrick/events{/privacy}","received_events_url":"https://api.github.com/users/flatrick/received_events","type":"User","site_admin":false},"created_at":"2018-12-09T10:02:31Z","updated_at":"2018-12-09T10:02:31Z","author_association":"NONE","body":"> I tried importing another series manually and this time it did not loop, so it seems like it may not have done that at all but only appeared because the episodes were copied in random order and were very large so took a very long time not to mention that the process started again on restart. That being said it is still a bug as there is not reason for Sonarr to copy the episodes even once and then remove them when permissions are incorrect when they are known in advance. Seems like checking source permissions prior to copying should be the simple solution to this issue.\r\n\r\nI'm experiencing something similiar. The permissions are identical to a different folder where Sonarr succeeded in copying the files so I dont understand why it's failing.\r\nI can see the file as it's being copied, but the logs then says it failed and the file is removed from the destination-folder.\r\nIs there anything I can do that could help pinpointing this issue?\r\n\r\nMessage: \r\n```Couldn't import episode /media/torrents/complete/Sonarr/SHOW.S12.720p.BluRay.x264-GROUP/SHOW.s12e08.720p.bluray.x264-GROUP.mkv: Access to the path is denied.```\r\n\r\nException:\r\n```\r\nSystem.UnauthorizedAccessException: Access to the path is denied.\r\n  at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00117] in /wrkdirs/usr/ports/lang/mono/work/mono-5.10.1.57/mcs/class/corlib/System.IO/File.cs:330 \r\n  at NzbDrone.Common.Disk.DiskProviderBase.MoveFileInternal (System.String source, System.String destination) [0x00000] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Common\\Disk\\DiskProviderBase.cs:232 \r\n  at NzbDrone.Mono.Disk.DiskProvider.MoveFileInternal (System.String source, System.String destination) [0x00076] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Mono\\Disk\\DiskProvider.cs:170 \r\n  at NzbDrone.Common.Disk.DiskProviderBase.MoveFile (System.String source, System.String destination, System.Boolean overwrite) [0x000e3] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Common\\Disk\\DiskProviderBase.cs:227 \r\n  at NzbDrone.Common.Disk.DiskTransferService.TryMoveFileVerified (System.String sourcePath, System.String targetPath, System.Int64 originalSize) [0x00047] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Common\\Disk\\DiskTransferService.cs:577 \r\n  at NzbDrone.Common.Disk.DiskTransferService.TryMoveFileTransactional (System.String sourcePath, System.String targetPath, System.Int64 originalSize, NzbDrone.Common.Disk.DiskTransferVerificationMode verificationMode) [0x0018b] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Common\\Disk\\DiskTransferService.cs:535 \r\n  at NzbDrone.Common.Disk.DiskTransferService.TransferFile (System.String sourcePath, System.String targetPath, NzbDrone.Common.Disk.TransferMode mode, System.Boolean overwrite, NzbDrone.Common.Disk.DiskTransferVerificationMode verificationMode) [0x003ce] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Common\\Disk\\DiskTransferService.cs:312 \r\n  at NzbDrone.Common.Disk.DiskTransferService.TransferFile (System.String sourcePath, System.String targetPath, NzbDrone.Common.Disk.TransferMode mode, System.Boolean overwrite, System.Boolean verified) [0x0000e] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Common\\Disk\\DiskTransferService.cs:196 \r\n  at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.TransferFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Tv.Series series, System.Collections.Generic.List`1[T] episodes, System.String destinationFilePath, NzbDrone.Common.Disk.TransferMode mode) [0x0012c] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Core\\MediaFiles\\EpisodeFileMovingService.cs:119 \r\n  at NzbDrone.Core.MediaFiles.EpisodeFileMovingService.MoveEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Parser.Model.LocalEpisode localEpisode) [0x0005e] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Core\\MediaFiles\\EpisodeFileMovingService.cs:81 \r\n  at NzbDrone.Core.MediaFiles.UpgradeMediaFileService.UpgradeEpisodeFile (NzbDrone.Core.MediaFiles.EpisodeFile episodeFile, NzbDrone.Core.Parser.Model.LocalEpisode localEpisode, System.Boolean copyOnly) [0x0017c] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Core\\MediaFiles\\UpgradeMediaFileService.cs:76 \r\n  at NzbDrone.Core.MediaFiles.EpisodeImport.ImportApprovedEpisodes.Import (System.Collections.Generic.List`1[T] decisions, System.Boolean newDownload, NzbDrone.Core.Download.DownloadClientItem downloadClientItem, NzbDrone.Core.MediaFiles.EpisodeImport.ImportMode importMode) [0x00272] in C:\\BuildAgent\\work\\5d7581516c0ee5b3\\src\\NzbDrone.Core\\MediaFiles\\EpisodeImport\\ImportApprovedEpisodes.cs:107 \r\n```"}}
{"actor":{"display_login":"flatrick"}}