﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10472	RegexURLResolver.reverse() is not threadsafe	tdterry	tdterry	"I have found an incomplete-initialization bug in `RegexURLResolver.reverse()` when running under Apache mpm_worker with mod_wsgi.

`RegexURLResolver` objects are stored in process local memory using `@memoize`.  The `_reverse_dict` is built on demand, so two threads trying to build it for the first time can run into an incomplete initialization.  The attached patch changes `RegexURLResolver._get_reverse_dict()` to do an atomic set of `self._reverse_dict`, preventing multiple threads from seeing an inconsistent `_reverse_dict`.

Testing requires a multi-threaded setup and a good load test. These are not available in the framework, so I have not included a specific test with the patch. 
"		closed	Core (Other)	1.0		fixed	urlresolvers, reverse, threading		Unreviewed	1	0	0	0	0	0
