Opened 5 years ago

Closed 5 years ago

#3759 closed defect (fixed)

Issue in LFC file usage

Reported by: sar Owned by: sar
Priority: medium Milestone: Kea0.9.1
Component: dhcp Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: Medium
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

During the LFC process we have:
0 Read leases
1 Write leases to output file
2 Move output file to finish file
3 Delete Previous and Copy files
4 Move finish file to previous file

If the LFC process is interrupted between 3 & 4 then when the server process next runs it will happily copy the current file to the copy file, then invoke the LFC process. The LFC process will notice that there is a finish file and decide that it was interrupted and happily delete the copy file thus losing the last updates from the last period.

After a short chat Marcin and I concluded the proper solution is to add a check in the server code to see if the finish file exists, if so the server doesn't do the copy but simply calls the LFC to finish processing.

Subtickets

Change History (4)

comment:1 Changed 5 years ago by sar

  • Owner changed from sar to UnAssigned
  • Status changed from new to reviewing

Ready for review

The code change is a single line to check if the finish file exists.

Most of the changes are the addition of two tests to verify the server doesn't move the current file if either the copy or previous files exist.

comment:2 Changed 5 years ago by stephen

  • Owner changed from UnAssigned to stephen

comment:3 Changed 5 years ago by stephen

  • Owner changed from stephen to sar

Reviewed commit a0918299c973c2f6b6ce1f3e5874f9dcfcac7b8c

src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
Line 619: typo - "contens"

leaseFileFinish test: The test should also check that the finish file does not exist after processing has completed.

ChangeLog
I think there should be a ChangeLog entry for this. Something along the lines of "Handle recovery properly should the LFC crash while manipulating files after completing processing."

After making these changes, please merge - I don't need to see it again.

comment:4 Changed 5 years ago by sar

  • Resolution set to fixed
  • Status changed from reviewing to closed

Updated per review comments, merged commit tag bb3b4d14119392261a1766da2b406fa46d4c0f21

Note: See TracTickets for help on using tickets.