The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation


How Dropbox Auto-Upgrade Works (and How to get AlwaysUp to Play Nice with it)

The Problem: Dropbox Automatic Updates

Recently, a few customers reported “issues” with Dropbox automatically updating itself and causing havoc when running under AlwaysUp in their 24×7 environments. Apparently the auto-upgrade would restart Dropbox outside of AlwaysUp and that unmanaged instance would prevent AlwaysUp from starting a new copy under its control. The result was hundreds of Explorer windows open on the screen — a great experience!

Our first instinct was to turn off automatic updates, which are usually a bad idea in a controlled, 24×7 environment anyway. Unfortunately Dropbox does not allow that. Auto-updates are totally managed by Dropbox and there are no exposed options for adjusting the behavior.

The lack of controls thwarted our second brilliant idea as well — scheduling auto-upgrades for a specific time each day/week/month. Apparently changes can take place at any time, at the program’s discretion. Again, not suitable in a managed environment.

A polite email to the Dropbox support folks explaining the situation and requesting help & advice yielded a most unsatisfying generic response:

Hi,

Thanks for writing in. While we'd love to answer every question we get,
we unfortunately can't respond to your inquiry due to a large volume of
support requests. Here are some resources for resolving the most common
issues:

Restore files or folders - www.dropbox.com/help/969
Reset your Dropbox password - www.dropbox.com/forgot
Reset/Disable two-step verification - www.dropbox.com/help/364
Learn about sharing files or folders - www.dropbox.com/help/category/Sharing
Learn about Dropbox's desktop app - www.dropbox.com/help/category/Desktop
Learn about Dropbox's mobile apps - www.dropbox.com/help/category/Mobile
For all other issues, please check out our Help Center - www.dropbox.com/help

We're sorry for the inconvenience,
The Dropbox Team

So time to do some reverse engineering!

The Investigation: How Dropbox Auto-Update Works

We installed an outdated version of Dropbox (2.47, thanks OldApps.com!) on our Windows Server 2012 machine, started it under AlwaysUp and patiently waited with Microsoft’s excellent Process Explorer open. It took about 8 minutes for the action to start…

  • First, Dropbox.exe launched dropbox-upgrade-2.8.2.exe, which it must have silently downloaded into the private cache folder (C:\Users\<UserName>\AppData\Roaming\Dropbox\.dropbox-cache).


    Dropbox upgrade running

  • A few seconds later, the update program spawned a second copy of Dropbox.exe, passing the ominous /killeveryone flag.

    Dropbox killeveryone running
  • Next, all instances of Dropbox subsequently shut down (including the one managed by AlwaysUp), and the updater launched a new copy of Dropbox before it too exited.
    Notice the peculiar command line arguments.


    A new instance of Dropbox is running

  • This is all fine when Dropbox is running normally on your desktop, but it is a problem when Dropbox is being managed by AlwaysUp. Indeed, once AlwaysUp noticed that the Dropbox process it was managing was closed, it started up a second copy:


    A new instance of Dropbox is running

  • Now Dropbox abhors multiple instances, so after a few seconds the AlwaysUp-controlled instance exits — but not before throwing up an Explorer window browsing the Dropbox folder. AlwaysUp, persistent fellow that it is, detects that Dropbox has once again exited, starts it up again and the whole process repeats. It is easy to see that if left unchecked, we may end up with hundreds of redundant Explorer windows!


    Many Dropbox Explorer Windows

The Solution: Configuring AlwaysUp to Tolerate Automatic Dropbox Updates

To prevent the auto-update from triggering ten billion Explorer windows, we must have AlwaysUp close the instance of Dropbox spawned during the upgrade prior to starting its own copy. To do so:

  1. Edit Dropbox in AlwaysUp

  2. Click over to the Startup tab.

    If you have AlwaysUp version 9.0 (released in December 2014) or later, check the Stop all copies of the application running on this computer and the Also whenever the application is restarted boxes as pictured here:


    Dropbox: Run a Single Instance

    Otherwise, if you have an earlier version of AlwaysUp without the “single instance” feature:

    • Download close-application.bat, a DOS batch file that will close a given application. Save it to the AlwaysUp folder (C:\Program Files\AlwaysUp, or C:\Program Files (x86)\AlwaysUp)

    • Check the Run the following program/batch file box and enter the following command line:

      “C:\Program Files (x86)\AlwaysUp\close-application.bat” Dropbox.exe

    • Check the Also run it whenever the application is restarted box as well.


      Close Dropbox at Startup

    These changes will cause AlwaysUp to close all running instances of Dropbox before starting the one that it will monitor.

  3. And finally, to give Dropbox some time to complete its auto-update before AlwaysUp tries to fire it up again, click over to the Restart tab and:

    1. Check the Whenever the application stops, restart it box
    2. Check the Not immediately, but box
    3. Select the After option and enter 5 minutes in the adjacent field.


    Delay Restarting Dropbox

  4. Click the Save >> button to record your settings.

That’s it! The next time Dropbox decides to automatically update itself, AlwaysUp will quickly bring it back under control — for continued 24×7 operation.

Posted in AlwaysUp | Tagged , | 8 Comments

8 Responses to How Dropbox Auto-Upgrade Works (and How to get AlwaysUp to Play Nice with it)

  1. Andrew Peterson says:

    We have this exact issue. Your solution works fine when there’s only one instance of Dropbox being managed by AlwaysUp, however our scenario has multiple instances of Dropbox (each running under a different local user account), which means taskkill /f /im “dropbox.exe” in your script will kill all instances running regardless of whether they’re the restarted instance following upgrade, or a pre-existing instance being managed by AlwaysUp. Do you have a solution where multiple Dropbox instances are running under AlwaysUp control, and one or more may randomly upgrade?

  2. Andrew Peterson says:

    UPDATE: Have created the following script to target processes by username only. Hence the only limit that remains with process-kill.bat is where the same image is running multiple times under the same account.

    @ECHO OFF
    IF [%1]==[] GOTO show-usage
    IF [%2]==[] GOTO show-usage
    SET exe-name=%1
    SET user-name=%2
    SET command-string=”tasklist.exe /FI “USERNAME eq %user-name%” /FI “IMAGENAME eq %exe-name%” | find /i “%exe-name%” ”
    IF %ERRORLEVEL% EQU 1 GOTO not-running
    FOR /f “tokens=1,2” %%a IN (‘%command-string%’) DO SET task-name=%%a&SET task-pid=%%b
    IF %ERRORLEVEL% EQU 1 GOTO not-found
    IF [%task-name%]==[] GOTO not-found
    IF [%task-pid%]==[] GOTO not-found
    taskkill /f /fi “PID eq %task-pid%”
    GOTO batch-end

    :not-found
    ECHO Process not found. (image: %exe-name% username: %user-name%)
    GOTO batch-end

    :show-usage
    echo Usage: process-kill ^ ^

    :batch-end

  3. Core Technologies Consulting says:

    Updated the instructions to use the new “single-running-copy” feature introduced in AlwaysUp version 9.0 (December 4 2014). No need to download and configure the batch file…

  4. Fred says:

    If you want to block the Dropbox auto upgrades, it can be done with security policies that block the execution of the upgrade. Please see Stefan F’s solution here.

  5. Dropbox almost always installs new version to different folder. Today it was Dropbox\Client_21.4.25. Always up was pointed to the Dropbox\Client folder which no longer had the executable. Any ideas?

  6. Core Technologies Consulting says:

    Thanks for alerting us. We’ll check it out and note what we find…

  7. Core Technologies Consulting says:

    Today’s clean install of Dropbox Build 22.4.24 on Windows 10 deposited Dropbox.exe in the expected location, namely:

    C:\Program Files (x86)\Dropbox\Client

    Dropbox Properties

    Unfortunately the folks at Dropbox no longer maintain a coherent change log, so it’s difficult to tell if including the version number in the installation folder was a bad idea that came and quickly went! 🙂

    This page provides what little information we have on Dropbox client builds.

    Please let us know if you see Dropbox installing to a non-standard folder again.

Leave a Reply

Your email address will not be published. Required fields are marked *