BIND 10 #326: Race condition in first startup (when database file does not exist)

BIND 10 Development do-not-reply at isc.org
Wed Aug 24 11:25:16 UTC 2011


#326: Race condition in first startup (when database file does not exist)
-------------------------------------+-------------------------------------
                   Reporter:  jelte  |                 Owner:  jelte
                       Type:         |                Status:  reviewing
  defect                             |             Milestone:
                   Priority:  major  |  Sprint-20110830
                  Component:  data   |            Resolution:
  source                             |             Sensitive:  0
                   Keywords:         |           Sub-Project:  DNS
            Defect Severity:         |  Estimated Difficulty:  8
  Medium                             |           Total Hours:  0
Feature Depending on Ticket:         |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
Changes (by stephen):

 * owner:  stephen => jelte


Comment:

 '''src/lib/datasrc/sqlite3_accessor.cc'''
 '''src/lib/datasrc/sqlite3_datasrc.cc'''

 ''check_schema_version()''
 The check
 {{{
 } else if (rc != SQLITE_BUSY || i == 50) {
 }}}
 ... inside the loop is wrong.  The "i == 50" condition will never be true
 as the loop termination condition is "i < 50".

 ''create_database()''
 Same issue as above with the "i == 50" check.

 "int rc" can be declared inside the loop and initialized with the call to
 sqlite3_exec().

 If the schema exists, the code returns the version but does not cancel the
 transaction started by executing "BEGIN EXCLUSIVE TRANSACTION". It should
 execute a rollback (or commit) before returning.

 ''checkAndSetupSchema()''
 If the schema does exist but the version is not equal to that expected,
 the code will attempt to create the database.  It should only create the
 database if the returned value from check_schema_version() is -1 (table
 does not exist); in all other cases it should report a version mismatch
 and terminate the program.

 ''general''
 The wait period (number of iterations of loops) should be symbolic
 constants.

 Not part of this ticket, but indenting the continuation lines of each
 statement in SCHEMA_LIST would make it more readable.

 ''src/lib/python/isc/datasrc/sqlite3_ds.py''
 Would it be possible to encapsulate the creation of the database into a
 Python-callable C++ module so that the creation code (also present in
 sqlite3_xxx.cc) is located in just one place?  At the moment the
 possibility exists of divergence between the Python and C++ creation
 functions.

-- 
Ticket URL: <http://bind10.isc.org/ticket/326#comment:12>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list