Skip to content

Commit

Permalink
SpawningKit HandshakePerform: ensure that more SpawnExceptions contai…
Browse files Browse the repository at this point in the history
…n information from the envdump dir
  • Loading branch information
FooBarWidget committed Jun 5, 2018
1 parent c3fa512 commit bd77908
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/agent/Core/SpawningKit/Handshake/Perform.h
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ class HandshakePerform {
SpawnException e(INTERNAL_ERROR, session.journey, config);
e.setSubprocessPid(pid);
e.setStdoutAndErrData(getStdoutErrData());
loadBasicInfoFromEnvDumpDir(e);
loadAnnotationsFromEnvDumpDir(e);

if (config->wrapperSuppliedByThirdParty) {
Expand Down Expand Up @@ -712,6 +713,7 @@ class HandshakePerform {
SpawnException e(INTERNAL_ERROR, session.journey, config);
e.setSubprocessPid(pid);
e.setStdoutAndErrData(getStdoutErrData());
loadBasicInfoFromEnvDumpDir(e);
loadAnnotationsFromEnvDumpDir(e);

e.setSummary("Error spawning the web application: the application"
Expand Down Expand Up @@ -758,6 +760,7 @@ class HandshakePerform {
SpawnException e(INTERNAL_ERROR, session.journey, config);
e.setSubprocessPid(pid);
e.setStdoutAndErrData(getStdoutErrData());
loadBasicInfoFromEnvDumpDir(e);
loadAnnotationsFromEnvDumpDir(e);

if (config->wrapperSuppliedByThirdParty) {
Expand Down Expand Up @@ -829,6 +832,7 @@ class HandshakePerform {
SpawnException e(INTERNAL_ERROR, session.journey, config);
e.setSubprocessPid(pid);
e.setStdoutAndErrData(getStdoutErrData());
loadBasicInfoFromEnvDumpDir(e);
loadAnnotationsFromEnvDumpDir(e);

e.setSummary("Error spawning the web application: the application"
Expand Down Expand Up @@ -871,6 +875,8 @@ class HandshakePerform {
e.setSubprocessPid(pid);
e.setStdoutAndErrData(getStdoutErrData());
e.setAdvancedProblemDetails(toString(internalFieldErrors));
loadBasicInfoFromEnvDumpDir(e);
loadAnnotationsFromEnvDumpDir(e);

e.setSummary("Error spawning the web application:"
" a bug in " SHORT_PROGRAM_NAME " caused the"
Expand Down Expand Up @@ -906,6 +912,7 @@ class HandshakePerform {
e.setSubprocessPid(pid);
e.setStdoutAndErrData(getStdoutErrData());
e.setAdvancedProblemDetails(toString(appSuppliedFieldErrors));
loadBasicInfoFromEnvDumpDir(e);
loadAnnotationsFromEnvDumpDir(e);

if (config->wrapperSuppliedByThirdParty) {
Expand Down Expand Up @@ -981,6 +988,7 @@ class HandshakePerform {
e.setAdvancedProblemDetails(toString(appSuppliedFieldErrors));
e.setSubprocessPid(pid);
e.setStdoutAndErrData(getStdoutErrData());
loadBasicInfoFromEnvDumpDir(e);
loadAnnotationsFromEnvDumpDir(e);

message = "<p>The " PROGRAM_NAME " application server tried"
Expand Down Expand Up @@ -1028,6 +1036,7 @@ class HandshakePerform {
SpawnException e(INTERNAL_ERROR, session.journey, config);
e.setStdoutAndErrData(getStdoutErrData());
e.setSubprocessPid(pid);
loadBasicInfoFromEnvDumpDir(e);
loadAnnotationsFromEnvDumpDir(e);

if (!config->genericApp && config->startsUsingWrapper) {
Expand Down Expand Up @@ -1200,6 +1209,7 @@ class HandshakePerform {
SpawnException e(INTERNAL_ERROR, session.journey, config);
e.setStdoutAndErrData(getStdoutErrData(stdoutAndErrCapturer));
e.setSubprocessPid(pid);
loadBasicInfoFromEnvDumpDir(e, session);
loadAnnotationsFromEnvDumpDir(e, session);

if (!config->genericApp && config->startsUsingWrapper) {
Expand Down Expand Up @@ -1292,6 +1302,7 @@ class HandshakePerform {
SpawnException e(INTERNAL_ERROR, session.journey, config);
e.setStdoutAndErrData(getStdoutErrData(stdoutAndErrCapturer));
e.setSubprocessPid(pid);
loadBasicInfoFromEnvDumpDir(e, session);
loadAnnotationsFromEnvDumpDir(e, session);

if (!config->genericApp && config->startsUsingWrapper) {
Expand Down Expand Up @@ -1439,7 +1450,6 @@ class HandshakePerform {
void loadSubprocessErrorMessagesAndEnvDump(SpawnException &e) const {
TRACE_POINT();
const string &responseDir = session.responseDir;
const string &envDumpDir = session.envDumpDir;

if (fileExists(responseDir + "/error/summary")) {
e.setSummary(strip(safeReadFile(session.responseErrorDirFd, "summary",
Expand Down Expand Up @@ -1469,14 +1479,22 @@ class HandshakePerform {
"solution_description.txt", SPAWNINGKIT_MAX_SUBPROCESS_ERROR_MESSAGE_SIZE).first)));
}

loadBasicInfoFromEnvDumpDir(e);
loadAnnotationsFromEnvDumpDir(e);
}

void loadBasicInfoFromEnvDumpDir(SpawnException &e) const {
loadBasicInfoFromEnvDumpDir(e, session);
}

static void loadBasicInfoFromEnvDumpDir(SpawnException &e, HandshakeSession &session) {
string envvars, userInfo, ulimits;
loadBasicInfoFromEnvDumpDir(envDumpDir, session.envDumpDirFd, envvars,
userInfo, ulimits);

loadBasicInfoFromEnvDumpDir(session.envDumpDir, session.envDumpDirFd,
envvars, userInfo, ulimits);
e.setSubprocessEnvvars(envvars);
e.setSubprocessUserInfo(userInfo);
e.setSubprocessUlimits(ulimits);

loadAnnotationsFromEnvDumpDir(e);
}

static void doClosedir(DIR *dir) {
Expand Down

0 comments on commit bd77908

Please sign in to comment.