[fdo-trac] #596: Threading issues with nls_msg_get_W2 under heavy load
FDO
trac_fdo at osgeo.org
Tue Dec 1 17:36:40 EST 2009
#596: Threading issues with nls_msg_get_W2 under heavy load
------------------------------+---------------------------------------------
Reporter: waltweltonlair | Owner: waltweltonlair
Type: defect | Status: new
Priority: major | Milestone: 3.5.0
Component: FDO API | Version: 3.4.0
Severity: 2 | Keywords:
External_id: |
------------------------------+---------------------------------------------
The implementation of nls_msg_get_W2 uses a 2D array of wchar's – it's
currently configured to store 8 strings of 5120 characters each. Each
time a call is made to this method the next string in the array is
populated with data and is returned. When the code gets to the 8th string
it wraps back around and uses the first one.
This method is thread-safe – a mutex only allows one thread to request a
string at a time. Nevertheless, the method has a threading vulnerability
in that it returns pointers to the 2D wchar array. If the load is high
enough (i.e. the number of active threads calling this method is high),
then at some point another thread will request a string that causes the 2D
array position to wrap back to a string that's currently being held and
processed by another thread. The new thread will overwrite the string,
resulting in an access violation in the other thread.
--
Ticket URL: <https://trac.osgeo.org/fdo/ticket/596>
FDO <http://fdo.osgeo.org/>
Feature Data Objects
More information about the fdo-trac
mailing list