Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#596 closed defect (fixed)

Threading issues with nls_msg_get_W2 under heavy load

Reported by: waltweltonlair Owned by: waltweltonlair
Priority: major Milestone: 3.5.0
Component: FDO API Version: 3.4.0
Severity: 2 Keywords:
Cc: External ID: 1278107

Description

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.

Change History (4)

comment:1 by waltweltonlair, 14 years ago

Status: newassigned

comment:2 by waltweltonlair, 14 years ago

External ID: 1278107

Fix submitted to trunk stream with r5117.

comment:3 by waltweltonlair, 14 years ago

Resolution: fixed
Status: assignedclosed

Fix submitted to 3.4 stream with r5118.

comment:4 by waltweltonlair, 14 years ago

Fixed a stupid merge error with r5136.

Note: See TracTickets for help on using tickets.