aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/break.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-11-30 16:51:40 +0100
committerBjörn-Egil Dahlberg <[email protected]>2012-11-30 16:51:40 +0100
commit7d926758c91abc7008dd06a2a944e2a17b9b0e85 (patch)
treedfc8b6236c0b786e21dadb97afef4f059695c0cb /erts/emulator/beam/break.c
parentd5de2e1ffd6403f5d7ec62e6ce8da508e1cb1239 (diff)
downloadotp-7d926758c91abc7008dd06a2a944e2a17b9b0e85.tar.gz
otp-7d926758c91abc7008dd06a2a944e2a17b9b0e85.tar.bz2
otp-7d926758c91abc7008dd06a2a944e2a17b9b0e85.zip
erts: Change default of erl_crash.dump
* Create an erl_crash.dump if no heart exists and no ERL_CRASH_DUMP_SECONDS is set (behaviour changed) * Don't create an erl_crash.dump if heart do exists and no ERL_CRASH_DUMP_SECONDS is set (behaviour not changed) This changes the behaviour back to the R15B02 default considering if a beam was running with no heart. The motivation is that we want a fast heart to fast restart erlang if it crashes but to be able to get non-truncated erl_crash.dumps via setting ERL_CRASH_DUMP_SECONDS if we so desire.
Diffstat (limited to 'erts/emulator/beam/break.c')
-rw-r--r--erts/emulator/beam/break.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/erts/emulator/beam/break.c b/erts/emulator/beam/break.c
index cf66f4e6b6..f7e9f15655 100644
--- a/erts/emulator/beam/break.c
+++ b/erts/emulator/beam/break.c
@@ -657,6 +657,7 @@ erl_crash_dump_v(char *file, int line, char* fmt, va_list args)
char dumpnamebuf[MAXPATHLEN];
char* dumpname;
int secs;
+ int env_erl_crash_dump_seconds_set = 1;
if (ERTS_SOMEONE_IS_CRASH_DUMPING)
return;
@@ -681,6 +682,8 @@ erl_crash_dump_v(char *file, int line, char* fmt, va_list args)
envsz = sizeof(env);
/* ERL_CRASH_DUMP_SECONDS not set
+ * if we have a heart port, break immediately
+ * otherwise dump crash indefinitely (until crash is complete)
* same as ERL_CRASH_DUMP_SECONDS = 0
* - do not write dump
* - do not set an alarm
@@ -702,8 +705,10 @@ erl_crash_dump_v(char *file, int line, char* fmt, va_list args)
*/
if (erts_sys_getenv__("ERL_CRASH_DUMP_SECONDS", env, &envsz) != 0) {
- return; /* break immediately */
+ env_erl_crash_dump_seconds_set = 0;
+ secs = -1;
} else {
+ env_erl_crash_dump_seconds_set = 1;
secs = atoi(env);
}
@@ -711,7 +716,16 @@ erl_crash_dump_v(char *file, int line, char* fmt, va_list args)
return;
}
- erts_sys_prepare_crash_dump(secs);
+ /* erts_sys_prepare_crash_dump returns 1 if heart port is found, otherwise 0
+ * If we don't find heart (0) and we don't have ERL_CRASH_DUMP_SECONDS set
+ * we should continue writing a dump
+ *
+ * beware: secs -1 means no alarm
+ */
+
+ if (erts_sys_prepare_crash_dump(secs) && !env_erl_crash_dump_seconds_set ) {
+ return;
+ }
if (erts_sys_getenv__("ERL_CRASH_DUMP",&dumpnamebuf[0],&dumpnamebufsize) != 0)
dumpname = "erl_crash.dump";