derrix060 / onedriveClient

A Microsoft OneDrive and OneDrive for Business client for Linux, written in Python3.
MIT License
65 stars 10 forks source link

Files in subdirectories not syncing #49

Open ghost opened 5 years ago

ghost commented 5 years ago

I'm experiencing issues with files in subdirectories failing to sync. I can create a directory, and this correctly appears on the drive (I can see it appearing on my Windows VM). However, any file I create within it won't sync:

[2019-07-30 12:35:27,395] INFO: MainThread: Local path "/home/rodom/OneDrive/test/test.txt" was updated on Event(wd=12, mask=8, cookie=0, name='test.txt'). Merge the parent directory.
[2019-07-30 12:35:27,597] ERROR: MainThread: Exception in callback LocalRepositoryWatcher.process_events()
handle: <Handle LocalRepositoryWatcher.process_events()>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
    self._callback(*self._args)
  File "/usr/local/lib/python3.6/dist-packages/onedrive_client/od_watcher.py", line 451, in process_events
    self.handle_event(ev, flags, move_pairs)
  File "/usr/local/lib/python3.6/dist-packages/onedrive_client/od_watcher.py", line 349, in handle_event
    repo, parent_dir = self.watch_descriptors[ev.wd]
  File "/usr/local/lib/python3.6/dist-packages/bidict-0.13.1-py3.6.egg/bidict/_common.py", line 96, in proxy
    return meth(*args)
KeyError: 12
[2019-07-30 12:35:27,770] ERROR: Worker-3: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..
[2019-07-30 12:35:27,770] ERROR: Worker-3: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test.. Skip directory "test".

If I stop and start onedrive-client it does successfully sync test.txt.

If I then create a subdirectory of this one, it still won't sync:

[2019-07-30 12:51:54,295] ERROR: MainThread: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..
[2019-07-30 12:51:54,296] CRITICAL: MainThread: Failed to create remote directory for "/home/rodom/OneDrive/test/test2". Fallback to merge.
[2019-07-30 12:51:54,498] ERROR: MainThread: Exception in callback LocalRepositoryWatcher.process_events()
handle: <Handle LocalRepositoryWatcher.process_events()>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
    self._callback(*self._args)
  File "/usr/local/lib/python3.6/dist-packages/onedrive_client/od_watcher.py", line 451, in process_events
    self.handle_event(ev, flags, move_pairs)
  File "/usr/local/lib/python3.6/dist-packages/onedrive_client/od_watcher.py", line 349, in handle_event
    repo, parent_dir = self.watch_descriptors[ev.wd]
  File "/usr/local/lib/python3.6/dist-packages/bidict-0.13.1-py3.6.egg/bidict/_common.py", line 96, in proxy
    return meth(*args)
KeyError: 3
[2019-07-30 12:51:54,707] ERROR: Worker-2: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..
[2019-07-30 12:51:54,708] ERROR: Worker-2: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test.. Skip directory "/test".

However in this case it won't create it even after restart:

[2019-07-30 12:52:08,454] ERROR: Worker-14: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..
[2019-07-30 12:52:08,455] ERROR: Worker-14: Error when creating remote dir of "/home/rodom/OneDrive/test/test2": -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..

I am experiencing this for other nested directory structures too, although I have one that has partially replicated (but not to its full depth) - I can't see how it differs from my tests.

Any suggestions?

derrix060 commented 5 years ago

That's weird and looks like a problem on the Microsoft side Microsoft.SharePoint.Client.ResourceNotFoundException.

Can you give me well-defined steps to reproduce it, then I can work on. (As far as I understood, if I create a dir and then a file inside this dir, it won't work?)

ghost commented 5 years ago

Sorry for the delay, I've been away. I've found it to be a bit weird and inconsistent - as I said, some things sync and some do not. However, here's some stuff I just did: mkdir test This syncs OK. mkdir test/test1 This fails:

[2019-09-05 08:56:08,970] ERROR: MainThread: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..
[2019-09-05 08:56:08,972] CRITICAL: MainThread: Failed to create remote directory for "/home/rodom/OneDrive/test/test1". Fallback to merge.
[2019-09-05 08:56:09,174] ERROR: MainThread: Exception in callback LocalRepositoryWatcher.process_events()
handle: <Handle LocalRepositoryWatcher.process_events()>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
    self._callback(*self._args)
  File "/usr/local/lib/python3.6/dist-packages/onedrive_client/od_watcher.py", line 451, in process_events
    self.handle_event(ev, flags, move_pairs)
  File "/usr/local/lib/python3.6/dist-packages/onedrive_client/od_watcher.py", line 349, in handle_event
    repo, parent_dir = self.watch_descriptors[ev.wd]
  File "/usr/local/lib/python3.6/dist-packages/bidict-0.13.1-py3.6.egg/bidict/_common.py", line 96, in proxy
    return meth(*args)
KeyError: 30
[2019-09-05 08:56:09,313] ERROR: Worker-4: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..
[2019-09-05 08:56:09,313] ERROR: Worker-4: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test.. Skip directory "/test".

touch test/test.txt Nothing happens, no log output. Restart onedrive-dclient. The file test/test.txt then syncs OK but the dir test/test1 does not:

[2019-09-05 08:59:15,579] ERROR: Worker-15: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..
[2019-09-05 08:59:15,579] ERROR: Worker-15: Error when creating remote dir of "/home/rodom/OneDrive/test/test1": -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..

touch test/test1/test.txt Nothing happens touch test/test2.txt

[2019-09-05 09:05:38,019] INFO: MainThread: Local path "/home/rodom/OneDrive/test/test2.txt" was updated on Event(wd=6, mask=8, cookie=0, name='test2.txt'). Merge the parent directory.
[2019-09-05 09:05:38,223] ERROR: MainThread: Exception in callback LocalRepositoryWatcher.process_events()
handle: <Handle LocalRepositoryWatcher.process_events()>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
    self._callback(*self._args)
  File "/usr/local/lib/python3.6/dist-packages/onedrive_client/od_watcher.py", line 451, in process_events
    self.handle_event(ev, flags, move_pairs)
  File "/usr/local/lib/python3.6/dist-packages/onedrive_client/od_watcher.py", line 349, in handle_event
    repo, parent_dir = self.watch_descriptors[ev.wd]
  File "/usr/local/lib/python3.6/dist-packages/bidict-0.13.1-py3.6.egg/bidict/_common.py", line 96, in proxy
    return meth(*args)
KeyError: 6
[2019-09-05 09:05:38,381] ERROR: Worker-15: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test..
[2019-09-05 09:05:38,381] ERROR: Worker-15: Encountered API Error: -1, Microsoft.SharePoint.Client.ResourceNotFoundException - Cannot find resource for the request test.. Skip directory "/test".

Restart onedrive-client The file test/test2.txt syncs but still no sign of the dir test/test1, errors as before.