vere: disable core dumps in king

lmdb size makes these impractical, and unmapping on SIGABRT
requires canceling threads, which is undefined
This commit is contained in:
Joe Bryan 2020-06-22 15:34:33 -07:00
parent 829d402dc9
commit 3330c3eaac
5 changed files with 14 additions and 63 deletions

View File

@ -476,16 +476,6 @@ _stop_exit(c3_i int_i)
u3_king_bail();
}
/* _stop_signal(): handle termination signal.
*/
static void
_stop_signal(c3_i int_i)
{
// if we have a pier, unmap the event log before dumping core
//
u3_king_halt();
}
/*
This is set to the the write-end of a pipe when Urbit is started in
daemon mode. It's meant to be used as a signal to the parent process
@ -642,10 +632,6 @@ main(c3_i argc,
//
signal(SIGTSTP, _stop_exit);
// Cleanup on SIGABRT.
//
signal(SIGABRT, _stop_signal);
printf("~\n");
// printf("welcome.\n");
printf("urbit %s\n", URBIT_VERSION);

View File

@ -832,11 +832,6 @@
u3_disk*
u3_disk_init(c3_c* pax_c, u3_disk_cb cb_u);
/* u3_disk_halt(): emergency close.
*/
void
u3_disk_halt(u3_disk* log_u);
/* u3_disk_exit(): close [log_u] and dispose.
*/
void
@ -1220,11 +1215,6 @@
void
u3_pier_bail(u3_pier* pir_u);
/* u3_pier_halt(): emergency resource release (ie, on SIGABRT).
*/
void
u3_pier_halt(u3_pier* pir_u);
/* u3_pier_save(): request checkpoint.
*/
c3_o
@ -1309,11 +1299,6 @@
void
u3_king_exit(void);
/* u3_king_halt(): emergency release.
*/
void
u3_king_halt(void);
/* u3_king_bail(): immediately shutdown.
*/
void

View File

@ -593,17 +593,6 @@ u3_disk_read_meta(u3_disk* log_u,
return c3y;
}
/* u3_disk_halt(): emergency close.
*/
void
u3_disk_halt(u3_disk* log_u)
{
if ( log_u->mdb_u ) {
u3_lmdb_exit(log_u->mdb_u);
log_u->mdb_u = 0;
}
}
/* u3_disk_exit(): close the log.
*/
void

View File

@ -717,6 +717,20 @@ u3_king_commence()
}
}
// disable core dumps (due to lmdb size)
//
{
struct rlimit rlm;
getrlimit(RLIMIT_CORE, &rlm);
rlm.rlim_cur = 0;
if ( 0 != setrlimit(RLIMIT_CORE, &rlm) ) {
u3l_log("king: unable to disable core dumps: %s\r\n", strerror(errno));
exit(1);
}
}
// initialize top-level timer
//
uv_timer_init(u3L, &u3K.tim_u);
@ -810,14 +824,6 @@ u3_king_exit(void)
_king_forall(u3_pier_exit);
}
/* u3_king_halt(): emergency release
*/
void
u3_king_halt(void)
{
_king_forall_unlink(u3_pier_halt);
}
/* u3_king_bail(): immediately shutdown.
*/
void

View File

@ -1526,21 +1526,6 @@ u3_pier_bail(u3_pier* pir_u)
_pier_done(pir_u);
}
/* u3_pier_halt(): emergency resource release (ie, on SIGABRT).
*/
void
u3_pier_halt(u3_pier* pir_u)
{
// unmap disk if present
//
// XX maybe skip close/cancel/free. and just unmap
//
if ( pir_u->log_u ) {
u3_disk_halt(pir_u->log_u);
pir_u->log_u = 0;
}
}
/* c3_rand(): fill a 512-bit (16-word) buffer.
*/
void