20130221 ======== Unit testing produces problems ------------------------------ The release with yesterday's small bugfixes was almost ready: - Release notes: :lino:`Lino 1.5.1 ` :welfare:`Welfare 1.0.13 ` But there was time left before the evening, so I started to clean up the test suite. This included a series of little internal optimizations in the startup process (details see yesterday (German only). Everything seemed fine and innocent until I deployed it on the `lino-framework.org` server: some strange failures, probably due to threading issues. Finally these small optimizations I made for the test suite had triggered an avalanche of changes, each of them very welcome and probably making Lino better in the long run... but not really at the right moment. Of course these surprises disturb my release process only because I don't use branching as I should... Anyway, these problems are solved in :checkin:`18584dc2ff18`. And still I'll spend the rest of today on the unit tests (because the long-term advantages are more important than the short-term risk) and without a branch (because branching does cost some "administrative" overhead, and because I'd rather enjoy my freedom as long as I am the only Lino developer). Insgesamt wird der Startup-Vorgang durch die gestrigen Änderungen geradliniger und klarer. Einer der kleinen Nebeneffekte ist, dass die SiteConfig-Instanz jetzt schon gleich beim Startup eingelesen und gecacht wird. Was zu einem coolen Bug führte: in :mod:`initdb ` und auch :mod:`initdb ` führte das zu einem Problem, das nur jedes zweite Mal auftrat: wenn die Datenbank von einem vorigen Lauf noch initialisiert war, enthielt die SiteConfig Verweise auf andere Objekte wie den Sektor, job_agent usw. Aber die wurden ja dann gelöscht. Und wenn dumppy die gecachte SiteConfig dann speicheren wollte, bekam er bein full_clean einen ValidationError. Lino startup in multi-threaded environment ------------------------------------------ I spent another hour to document a problem which took me a few hours to understand. .. literalinclude:: 0221.py Constellation 1 is on a development server:: SINGLE_THREADED is True, WAIT_BEFORE_ACCESSING_UI is 0 Incoming request1: Starting up . . . . done yes Incoming request2: Constellation 2 on a mod_wsgi until yesterday:: SINGLE_THREADED is False, WAIT_BEFORE_ACCESSING_UI is 2 Incoming request1: Starting up . Incoming request2: . . . done yes yes Constellation 3 on a mod_wsgi after yesterday:: SINGLE_THREADED is False, WAIT_BEFORE_ACCESSING_UI is 0 Incoming request1: Starting up . Incoming request2: Exception in thread Thread-2: Traceback (most recent call last): File "c:\Python27\lib\threading.py", line 530, in __bootstrap_inner self.run() File "c:\Python27\lib\threading.py", line 483, in run self.__target(*self.__args, **self.__kwargs) File "0221.py", line 49, in main print LINO.ui AttributeError: 'Lino' object has no attribute 'ui' . . . done yes