steilerDev / icloud-photos-sync

One-way sync engine for the iCloud Photos Library into the native file system
https://icps.steiler.dev/
GNU General Public License v3.0
340 stars 9 forks source link

PID locked when attempting sync #372

Closed natcl closed 10 months ago

natcl commented 11 months ago

Describe the issue

Hello, I'm running icloud-photos-sync on a Synology via docker, version 1.2.0. I was able to sync my photos manually inside the container by running the sync command but it seems to fail in daemon mode, I get a PID locked error (for PID 1) but PID 1 is the actual daemon command, not sure why it would fail ?

How to reproduce the behavior?

This seems to happen in daemon mode when then cron job executes.

Error Code

Not sure where to find this

Relevant log output

Error: APP_DAEMON: Error during scheduled execution caused by APP_SYNC: Sync failed caused by LIBRARY_LOCK_ACQUISITION: Unable to acquire library lock caused by LIBRARY_LOCKED: Library locked. Use --force (or FORCE env variable) to forcefully remove the lock (Locked by PID 1)

Detected error during sync: SYNC_UNKNOWN: Unknown error during sync caused by ICLOUD_PHOTOS_FOLDER_STRUCTURE: Unable to fetch folder structure caused by connect ECONNREFUSED 127.0.0.1:80

Operating system

Synology SRM 7

Execution environment

Docker

icloud-photos-sync version

1.2.0

Checklist

steilerDev commented 11 months ago

This means that there is a .library.lock file present in your library folder - go ahead remove that and/or start the tool with --force.

This file might still be there in case a previous sync run did not complete successfully (e.g. because you killed the process by restarting the container). Another possibility is, that there is still a sync run going on in your container - so make sure this is not the case.

natcl commented 11 months ago

Thanks for your answer ! the lock file should be in the /opt/icloud-photos-sync folder ? I don't seem to see a lock file there:

d---------    1 root     root         510 Oct  8 21:42 .03D30598-3CA6-4A64-8A56-8E09560B48E2                                                                              
d---------    1 root     root           0 Oct  8 21:42 .0C5373F1-1850-4540-AC5A-46D9DC27D679                                                                              
d---------    1 root     root         200 Oct  8 21:42 .137CEDA7-CB0F-46DC-A645-6707B8221027                                                                              
d---------    1 root     root          72 Oct  8 21:42 .1A82A9C1-EBF8-4561-B5DC-BC84ECB83513                                                                              
d---------    1 root     root           0 Oct  8 21:42 .2878E7D2-7E4E-499B-B248-00A782C365A8                                                                              
d---------    1 root     root         164 Oct  8 21:42 .28F7C5AE-FD4F-4819-9BF1-2597491A99E3                                                                              
d---------    1 root     root          40 Oct  8 21:42 .299238FC-FFE4-456C-BF9B-BDFF8EBAA126                                                                              
d---------    1 root     root         184 Oct  8 21:42 .694EF70F-1132-446B-B6A2-EE5CAEFB3743                                                                              
d---------    1 root     root         244 Oct  8 21:42 .6AA87C8A-4405-4E4A-B965-B1444573B4F0                                                                              
d---------    1 root     root         546 Oct  8 21:42 .6F2B699F-9091-441F-B562-BACDC66230D4                                                                              
d---------    1 root     root        3.0K Oct 11 07:02 .7CE05D41-75FD-4F2A-A1EF-963317CC120C                                                                              
d---------    1 root     root           0 Oct 11 07:02 .7DB42D6B-6A69-4D6B-8995-B53C97392CF1                                                                              
d---------    1 root     root           0 Oct  8 21:42 .84F96A7C-06FD-4AEE-88BD-EADE7895F726                                                                              
d---------    1 root     root        3.4K Oct  8 21:42 .8E8DF843-ABB6-447B-8E07-516271156176                                                                              
d---------    1 root     root        9.3K Oct  8 21:42 .A31461DE-9C64-43BC-8B5E-31BC5D4D4B8C                                                                              
d---------    1 root     root        2.8K Oct  8 21:42 .BDE6E886-8FD4-49F2-ACD2-6C58C0C1848F                                                                              
d---------    1 root     root        5.1K Oct  8 21:42 .BFC37400-F2D9-49D9-B497-9CE331DC8AA0                                                                              
d---------    1 root     root          72 Oct  8 21:42 .DADA6096-2EA2-44C9-B1F0-3E0383B41ABC                                                                              
----------    1 1026     users      10.0K Oct 10 15:53 .DS_Store                                                                                                          
d---------    1 root     root           0 Oct  8 21:42 .E1F3A62B-6BCD-4264-B9A8-92734CEB08B7                                                                              
d---------    1 root     root         910 Oct  8 21:42 .F1CFD12E-6677-4820-8325-798FD0E2EBA6                                                                              
d---------    1 root     root        1.6K Oct  8 21:42 .F7CEBBF0-18A1-463B-88AA-97088880A610                                                                              
d---------    1 root     root        2.0K Oct  8 21:42 .FA0DDEE5-A2DB-41B1-B490-AC729D3195A0                                                                              
d---------    1 root     root        4.6K Oct  8 21:42 .FCB7EF16-C9C6-40E0-B3B4-B8D5235F8C90                                                                              
----------    1 root     root         281 Oct 11 06:58 .icloud-photos-sync                                                                                                
----------    1 root     root       65.0K Oct 11 07:02 .icloud-photos-sync.log                                                                                            
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 8307 St-Denis -> .FA0DDEE5-A2DB-41B1-B490-AC729D3195A0                                                             
drwxrwxrwx    1 root     root          52 Sep 25 18:10 @eaDir                                                                                                             
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 AI -> .BDE6E886-8FD4-49F2-ACD2-6C58C0C1848F                                                                        
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Archive -> .8E8DF843-ABB6-447B-8E07-516271156176                                                                   
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Argent -> .137CEDA7-CB0F-46DC-A645-6707B8221027                                                                    
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Danielle -> .84F96A7C-06FD-4AEE-88BD-EADE7895F726                                                                  
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Drôle -> .03D30598-3CA6-4A64-8A56-8E09560B48E2                                                                    
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Dude -> .694EF70F-1132-446B-B6A2-EE5CAEFB3743                                                                      
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Enfance -> .299238FC-FFE4-456C-BF9B-BDFF8EBAA126                                                                   
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Événements -> .7CE05D41-75FD-4F2A-A1EF-963317CC120C                                                              
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Inbox -> .A31461DE-9C64-43BC-8B5E-31BC5D4D4B8C                                                                     
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Instagram -> .0C5373F1-1850-4540-AC5A-46D9DC27D679                                                                 
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Layout -> .28F7C5AE-FD4F-4819-9BF1-2597491A99E3                                                                    
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 MF -> .F1CFD12E-6677-4820-8325-798FD0E2EBA6                                                                        
lrwxrwxrwx    1 root     root          37 Oct 11 07:02 Objectifs -> .7DB42D6B-6A69-4D6B-8995-B53C97392CF1                                                                 
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Pinouts -> .1A82A9C1-EBF8-4561-B5DC-BC84ECB83513                                                                   
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Plomberie -> .6F2B699F-9091-441F-B562-BACDC66230D4                                                                 
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 RAW -> .E1F3A62B-6BCD-4264-B9A8-92734CEB08B7                                                                       
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 Scannable -> .DADA6096-2EA2-44C9-B1F0-3E0383B41ABC                                                                 
lrwxrwxrwx    1 root     root          37 Oct  8 21:42 WhatsApp -> .6AA87C8A-4405-4E4A-B965-B1444573B4F0                                                                  
d---------    1 root     root      631.3K Oct  8 21:46 _All-Photos                                                                                                        
d---------    1 root     root          12 Oct  8 15:06 _Archive                                                                                                           
d---------    1 root     root      123.7K Oct 10 13:42 _Shared-Photos                                                                                                     
natcl commented 11 months ago

Also, if I attempt it manually after (by doing a docker exec and the sync command) it works without using --force, seems like the issue only happen when run from the daemon

steilerDev commented 11 months ago

Fascinating - have you tried restarting the container?

natcl commented 11 months ago

It does restart on it's own each the error occurs.

natcl commented 11 months ago

Here's the full log if it can help icloud-photos-sync.csv

steilerDev commented 11 months ago

Can you please share the log file (instead of the synology stdout)?

However when looking at the shared information, the root cause is not that the library is locked (which seems to be correct), but that your sync/and or load fails. A full log (including LOG_LEVEL='debug') should help narrow it down.

natcl commented 11 months ago

I just tried again (in daemon mode) and it completed successfully, I'll leave it running and check tomorrow if it succeeds again. Thanks !

natcl commented 10 months ago

Wasn't able to see a crash after I retried so perhaps I got unlucky the first time, we can close this for now, thanks !

steilerDev commented 10 months ago

Sounds good - thanks for the feedback @natcl !