IllegalUseOfScopeReplacer on concurrent initial requests
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Confirmed
|
Low
|
Unassigned | ||
loggerhead |
Triaged
|
Critical
|
Unassigned |
Bug Description
When you first start up a loggerhead instance, none of the lazy_imports have been triggered.
If you get 2 concurrent requests right away, then it is possible for them to trigger IllegalUseOfSco
A simple way to demonstrate this is:
bzr serve --http &
# wait for it to start
wget http://
The traceback is often different, because it depends on where the two threads become synchronized on importing the same lazy import.
One very quick workaround for it is to just issue a single request after startup, triggering 99% of the lazy imports to be triggered that will normally ever be triggered.
I'll also include bzr as part of the bug. This is because LazyImports aren't particularly compatible with multi-threading, but only loggerhead really stresses multithreading with bzrlib.
Considering this low importance, because it only really triggers immediately when loggerhead is started. Once it has served a request, most imports will already be triggered.
Changed in loggerhead: | |
status: | Confirmed → Triaged |
Confirming that lazy_imports don't play well with multi-threading. It might be nice if we had some sort of flag that allowed the scope replacer objects to proxy, or possibly disable lazy importing entirely for a given command. Though because of circular imports, we probably can't disable it 100%.