SeattleTestbed/softwareupdater

software updater cannot perform update if servicelogger breaks

Closed this issue · 2 comments

The software updater uses the servicelogger for logging messages. If the servicelogger breaks (that is, if it reliably throws an exception whenever it's initialized or when it's used), the software updater will not be able to run.

All usages of the servicelogger should be wrapped in try/except blocks and the software updater should default to printing to stderr if the servicelogger fails. This way nodes with a broken servicelogger can still update (e.g. to fix the servicelogger).

Note: there are no known cases of this having been a problem.

Author: jsamuel
I actually saw the below exception today while testing the softwareupdater on Windows. However, I didn't spend much time trying to reproduce it as I was debugging other issues. This just gives motivation for the idea that servicelogger calls in the software updater should be wrapped in try/except blocks.

It's not out of the question that something I had done caused this. For example, I was copying/opening log files so I could view them. It's possible that this could never happen in normal usage.

C:\Documents and Settings\admin\Desktop\seattle_win\seattle_repy>python.exe soft
wareupdater.py
Traceback (most recent call last):
  File "softwareupdater.py", line 705, in <module>
    servicelogger.log(str(e))
  File "C:\Documents and Settings\admin\Desktop\seattle_win\seattle_repy\service
logger.py", line 2662, in log
    logfile.write(str(time.time()) + ':PID-' + str(os.getpid()) + ':' + str(mess
age) + '\n')
  File "C:\Documents and Settings\admin\Desktop\seattle_win\seattle_repy\logging
.py", line 221, in write
    writeamt = self.writedata(writeitem)
  File "C:\Documents and Settings\admin\Desktop\seattle_win\seattle_repy\logging
.py", line 296, in writedata
    self.activefo.write(str(data[:splitindex]))
ValueError: I/O operation on closed file

Author: jsamuel
Fixed in r2487.