netopeer2
netopeer2 copied to clipboard
ncc_changes_rollback_cb not being called at startup if failed confirmed-commit is detected in the past
Version 2.1.36
In main.c the call tries restore previous confirmed commit
/* Restore a previous confirmed commit if restore file exists */
ncc_try_restore();
The code reads the meta file and looks at the timestamp and timeout. If the timeout was in the past, the code calls
VRB("Restoring a previous confirmed commit.");
ncc_commit_timeout_schedule(new_timeout);
but new_timeout will be 0 in this case. ncc_commit_timeout_schedule has this code
if (timer_settime(timer_id, 0, &its, NULL) == -1) {
ERR("Could not set time in timer for confirmed commit rollback (%s).", strerror(errno));
return SR_ERR_SYS;
}
The its structure will be all 0's. From the linux timer_settime manual page we see
If new_value->it_value specifies a zero value (i.e., both subfields are zero), then the timer is disarmed.
The timer_settimer will not set a timer but rather the timer will be disarmed or in this case, never armed. This leaves the previous confirmed commit around forever and then causes issues where an subsequent confirmed commit will fail.
Right, should work now.