Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-680

Fix unwanted local upload when offline (on connection lost for instance)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1130
    • Fix Version/s: 2.4.6
    • Component/s: Local watcher

      Description

      Root Cause:
      When drive is offline due to network down, still the watcher threads are active.
      localWatcher detects more than 200 events, which is higher than _windows_queue_threshold 50, this leads to enabling trigger_local_scan.
      In local scan _scan(), we need the fix similar to NXDRIVE-644.

      local watcher execute function()

                  while (1):
                      self._interact()
                      sleep(0.01)
                      if trigger_local_scan:
                          self._action = Action("Full local scan")
                          self._scan()
                          trigger_local_scan = False
                          self._end_action()
                      while (not self._watchdog_queue.empty()):
                          # Dont retest if already local scan
                          if not trigger_local_scan and self._watchdog_queue.qsize() > self._windows_queue_threshold:
                              log.debug('Windows queue threshold exceeded, will trigger local scan: %d events', self._watchdog_queue.qsize())
                              trigger_local_scan = True
                              self._delete_events.clear()
                              self._folder_scan_events.clear()
                              self._watchdog_queue = Queue()
                              break
                          evt = self._watchdog_queue.get()
                          self.handle_watchdog_event(evt)
                          self._win_delete_check()
                          self._win_folder_scan_check()
                      self._win_delete_check()
                      self._win_folder_scan_check()
      

      Fix: introduce to_pause flag in _scan() similar to fix in NXDRIVE-644

          def _scan(self):
              log.debug("Full scan started")
              start_ms = current_milli_time()
              to_pause = not self._engine.get_queue_manager().is_paused()
              if to_pause:
                  self._suspend_queue()
              self._delete_files = dict()
              self._protected_files = dict()
      
              info = self.client.get_info(u'/')
              self._scan_recursive(info)
              self._scan_handle_deleted_files()
              self._metrics['last_local_scan_time'] = current_milli_time() - start_ms
              log.debug("Full scan finished in %dms", self._metrics['last_local_scan_time'])
              self._local_scan_finished = True
              if to_pause:
                  self._engine.get_queue_manager().resume()
              self.localScanFinished.emit()
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 3 hours, 10 minutes
                1d 3h 10m