mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 02:11:38 +03:00
Merge pull request #1272 from urbit/ccr-pier-leak
cc-release: fix memory bug, tweak limits and core dumps
This commit is contained in:
commit
f793e5da2d
@ -467,6 +467,8 @@ report(void)
|
||||
printf("argon2: 0x%x\n", ARGON2_VERSION_NUMBER);
|
||||
}
|
||||
|
||||
/* _stop_exit(): exit immediately.
|
||||
*/
|
||||
static void
|
||||
_stop_exit(c3_i int_i)
|
||||
{
|
||||
@ -476,6 +478,18 @@ _stop_exit(c3_i int_i)
|
||||
u3_daemon_bail();
|
||||
}
|
||||
|
||||
/* _stop_trace(): print trace on SIGABRT.
|
||||
*/
|
||||
static void
|
||||
_stop_trace(c3_i int_i)
|
||||
{
|
||||
// if we have a pier, unmap the event log before dumping core
|
||||
//
|
||||
if ( 0 != u3K.len_w ) {
|
||||
u3_pier_db_shutdown(u3_pier_stub());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
@ -626,6 +640,10 @@ main(c3_i argc,
|
||||
//
|
||||
signal(SIGTSTP, _stop_exit);
|
||||
|
||||
// Cleanup on SIGABRT.
|
||||
//
|
||||
signal(SIGABRT, _stop_trace);
|
||||
|
||||
printf("~\n");
|
||||
// printf("welcome.\n");
|
||||
printf("urbit %s\n", URBIT_VERSION);
|
||||
|
@ -1174,6 +1174,11 @@
|
||||
|
||||
/** Pier control.
|
||||
**/
|
||||
/* u3_pier_db_shutdown(): close the log.
|
||||
*/
|
||||
void
|
||||
u3_pier_db_shutdown(u3_pier* pir_u);
|
||||
|
||||
/* u3_pier_interrupt(): interrupt running process.
|
||||
*/
|
||||
void
|
||||
|
@ -601,7 +601,7 @@ _boothack_key(u3_noun kef)
|
||||
u3_noun whu = u3dc("slaw", 'p', u3k(woh));
|
||||
|
||||
if ( u3_nul == whu ) {
|
||||
u3l_log("dawn: invalid ship specificed with -w %s\r\n",
|
||||
u3l_log("dawn: invalid ship specified with -w %s\r\n",
|
||||
u3_Host.ops_u.who_c);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -506,6 +506,30 @@ _dawn_come(u3_noun stars)
|
||||
c3_c* who_c = u3r_string(who);
|
||||
|
||||
u3l_log("boot: found comet %s\r\n", who_c);
|
||||
|
||||
// enable to print and save comet private key for future reuse
|
||||
//
|
||||
#if 0
|
||||
{
|
||||
u3_noun key = u3dc("scot", c3__uw, u3qe_jam(seed));
|
||||
c3_c* key_c = u3r_string(key);
|
||||
|
||||
u3l_log("boot: comet private key\n %s\n", key_c);
|
||||
|
||||
{
|
||||
c3_c pat_c[64];
|
||||
snprintf(pat_c, 64, "%s.key", who_c + 1);
|
||||
|
||||
FILE* fil_u = fopen(pat_c, "w");
|
||||
fprintf(fil_u, "%s\n", key_c);
|
||||
fclose(fil_u);
|
||||
}
|
||||
|
||||
free(key_c);
|
||||
u3z(key);
|
||||
}
|
||||
#endif
|
||||
|
||||
free(who_c);
|
||||
u3z(who);
|
||||
}
|
||||
|
@ -79,10 +79,10 @@ _pier_db_bail(void* vod_p, const c3_c* err_c)
|
||||
u3l_log("disk error: %s\r\n", err_c);
|
||||
}
|
||||
|
||||
/* _pier_db_shutdown(): close the log.
|
||||
/* u3_pier_db_shutdown(): close the log.
|
||||
*/
|
||||
static void
|
||||
_pier_db_shutdown(u3_pier* pir_u)
|
||||
void
|
||||
u3_pier_db_shutdown(u3_pier* pir_u)
|
||||
{
|
||||
u3_lmdb_shutdown(pir_u->log_u->db_u);
|
||||
}
|
||||
@ -508,7 +508,7 @@ _pier_work_boot(u3_pier* pir_u, c3_o sav_o)
|
||||
u3_noun len = u3i_chubs(1, &pir_u->lif_d);
|
||||
|
||||
if ( c3y == sav_o ) {
|
||||
_pier_db_write_header(pir_u, who, u3k(pir_u->fak_o), len);
|
||||
_pier_db_write_header(pir_u, u3k(who), pir_u->fak_o, u3k(len));
|
||||
}
|
||||
|
||||
u3_noun msg = u3nq(c3__boot, who, pir_u->fak_o, len);
|
||||
@ -844,7 +844,7 @@ _pier_work_exit(uv_process_t* req_u,
|
||||
u3l_log("pier: exit: status %" PRIu64 ", signal %d\r\n", sas_i, sig_i);
|
||||
uv_close((uv_handle_t*) req_u, 0);
|
||||
|
||||
_pier_db_shutdown(pir_u);
|
||||
u3_pier_db_shutdown(pir_u);
|
||||
_pier_work_shutdown(pir_u);
|
||||
}
|
||||
|
||||
@ -1787,7 +1787,7 @@ _pier_exit_done(u3_pier* pir_u)
|
||||
{
|
||||
u3l_log("pier: exit\r\n");
|
||||
|
||||
_pier_db_shutdown(pir_u);
|
||||
u3_pier_db_shutdown(pir_u);
|
||||
_pier_work_shutdown(pir_u);
|
||||
_pier_loop_exit(pir_u);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user