lp:~jaypipes/drizzle/bugs
- Get this branch:
- bzr branch lp:~jaypipes/drizzle/bugs
Branch merges
- Brian Aker: Pending requested
- Drizzle Developers: Pending requested
-
Diff: 129 lines (+23/-23)2 files modifieddrizzled/temporal_format.cc (+23/-22)
drizzled/temporal_format.h (+0/-1)
Related bugs
Bug #384531: compile failure centos 5.2 | Critical | Fix Released | |
Bug #402831: Query Logging output missing a comma | Medium | Fix Released | |
Bug #402855: session->connect_utime doesn't appear to be populated | Medium | Fix Released | |
Bug #409711: plugin/command_log/command_log.cc can't be compiled on 32 bit platforms | Medium | Fix Released | |
Bug #434128: Build failure on debian | Critical | Fix Released | |
Bug #500031: dbt2 fails with 1024 connections | High | Fix Released |
Related blueprints
Recent revisions
- 1253. By Jay Pipes <jpipes@serialcoder>
-
Fixes LP Bug #500031:
"dbt2 fails with 1024 connections"
After investigation into this, I discovered that there was a
race condition in TemporalFormat::match( ): TemporalFormat::_re is the compiled PCRE regular expression object
inside each of the TemporalFormat objects, which are shared
among all threads and live in global scope.Unfortunately, TemporalFormat:
:match( ) was using the member
variable TemporalFormat::_match_ vector as its match state.
At high concurrency, this means that the following race
condition could happen:Thread 1 executes pcre_exec() and finds a match, therefore
populating TemporalFormat::_match_ vector of integers
with the position offsets of the matched pieces of the temporal object.Thread 1, during construction of the Temporal output of
TemporalFormat::match( ), uses these _match_vector position
offsets in calling std::string::substr on a copy of the
matched string, essentially "cutting up" the string
into year, month, day, etc.Thread 2 executes pcre_exec() and also finds a match,
thereby changing TemporalFormat::_match_ vector to something
differentThread 1 continues trying to use std::string:
:substr( ),
but now uses offsets that are invalid for its string,
thereby producing an out_of_range exception.The solution is to pull the TemporalFormat:
:_match_ vector
member variable and instead put a function-scope-level
match_vector variable on the stack inside TemporalFormat::match( ).
Branch metadata
- Branch format:
- Branch format 7
- Repository format:
- Bazaar repository format 2a (needs bzr 1.16 or later)
- Stacked on:
- lp:~drizzle-trunk/drizzle/development