Skip to content

Commit

Permalink
Merge branch 'master' into direct-rdata-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
wcawijngaards committed Jan 17, 2025
2 parents 0434e7c + 2b66832 commit 90370a8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
3 changes: 3 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
17 January 2025: Willem
- Fix #424: Stalled updates after corrupt transfer.

15 January 2025: Wouter
- Fix whitespace in comment.

Expand Down
1 change: 1 addition & 0 deletions doc/RELNOTES
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ BUG FIXES:
from old-main that it is done on the reload_listener pipe.
Thanks Otto Retter.
- Fix whitespace in comment.
- Fix #424: Stalled updates after corrupt transfer.

4.11.0
================
Expand Down
22 changes: 14 additions & 8 deletions server.c
Original file line number Diff line number Diff line change
Expand Up @@ -2658,7 +2658,7 @@ server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio,
exit(1);
}
assert(cmd == NSD_RELOAD);
udb_ptr_unlink(last_task, nsd->task[nsd->mytask]);
udb_ptr_set(last_task, nsd->task[nsd->mytask], 0);
task_process_sync(nsd->task[nsd->mytask]);
#ifdef USE_ZONE_STATS
server_zonestat_realloc(nsd); /* realloc for next children */
Expand Down Expand Up @@ -2972,13 +2972,24 @@ server_main(struct nsd *nsd)
task_remap(nsd->task[nsd->mytask]);
udb_ptr_init(&xfrs2process, nsd->task[nsd->mytask]);
udb_ptr_init(&last_task , nsd->task[nsd->mytask]);
/* last_task and xfrs2process MUST be unlinked in all
* possible branches of the fork() below.
* server_reload() will unlink them, but for failed
* fork and for the "old-main" (child) process, we MUST
* unlink them in the case statement below.
* Unlink by setting the value to 0, because
* reload_process_non_xfr_tasks() may clear (and
* implicitly unlink) xfrs2process.
*/
reload_process_non_xfr_tasks(nsd, &xfrs2process
, &last_task);
/* Do actual reload */
reload_pid = fork();
switch (reload_pid) {
case -1:
log_msg(LOG_ERR, "fork failed: %s", strerror(errno));
udb_ptr_set(&last_task, nsd->task[nsd->mytask], 0);
udb_ptr_set(&xfrs2process, nsd->task[nsd->mytask], 0);
break;
default:
/* PARENT */
Expand Down Expand Up @@ -3010,6 +3021,8 @@ server_main(struct nsd *nsd)
#ifdef USE_LOG_PROCESS_ROLE
log_set_process_role("old-main");
#endif
udb_ptr_set(&last_task, nsd->task[nsd->mytask], 0);
udb_ptr_set(&xfrs2process, nsd->task[nsd->mytask], 0);
reload_listener.fd = reload_sockets[0];
reload_listener.timeout = NULL;
reload_listener.user_data = nsd;
Expand All @@ -3030,13 +3043,6 @@ server_main(struct nsd *nsd)
log_set_process_role("main");
#endif
}
/* xfrs2process and last_task need to be reset in case
* "old-main" becomes "main" (due to an failed (exited)
* xfr update). If needed xfrs2process gets unlinked by
* "load", and last_task by the xfrd.
*/
memset(&xfrs2process, 0, sizeof(xfrs2process));
memset(&last_task, 0, sizeof(last_task));
break;
case NSD_QUIT_SYNC:
/* synchronisation of xfrd, parent and reload */
Expand Down

0 comments on commit 90370a8

Please sign in to comment.