Dealing with stale code in long-running processes

Webware's Shotgun Approach

The problem

Clever hacks don't work

(Itamar Shtull-Trauring told me after this talk that when a class uses __slots__ even the clever hacks won't work)

Webware's shotgun approach

Webware's shotgun restart

The application server is started with a shell script:

retcode=3
while test $retcode -eq 3; do
    /usr/bin/env python $OPTIONS Launch.py ThreadedAppServer $*
    retcode=$?
done

Or in Windows:

:restart
python Launch.py ThreadedAppServer %1 %2 %3 %4 %5 %6 %7 %8 %9
if errorlevel 3 goto restart

Problems

We don't keep track of files that, if they existed, would effect the execution. For instance, when you import a file that doesn't exist (which usually causes an error) -- the server should really be restarted once that file comes back into existance. Or a configuration file that doesn't exist but could. Still, it might become hard to track this sort of thing.

If you are editing a file that's automatically loaded up when the system is loaded up, then everytime you save that file (even though you may not be done with your edits) you will cause the AppServer to restart. In Webware, most code you'll be editing is loaded only on demand, so it's not usually a problem.

We check many files that probably don't need to be checked, like files in the standard library.