Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #29] - Improve diagnostics of Process reading in the native code #39

Merged

Conversation

oleg-nenashev
Copy link
Member

@oleg-nenashev oleg-nenashev commented Apr 20, 2017

This change should significantly improve the diagnostics info for #29 in some corner cases. All the issues below may lead to #29 or to "Failed to read PEB" (e.g. JENKINS-8614 in Jenkins tests)

Native:

Java:

  • Enable stacktraces and core dumps for the build failure
  • More tests

Work is in progress, because AppVeyor JVM was crashing, need to investigate. likely it is due to the isWow64() method, where I oversimplified the pattern once the simple approach worked.

@reviewbybees

@oleg-nenashev
Copy link
Member Author

So yes, I should not have removed the intelligent import code, which has been proposed for https://msdn.microsoft.com/en-us/library/ms684139.aspx . AppVeyor is not running builds as a desktop App, hence it captured the API misusage.

@oleg-nenashev oleg-nenashev self-assigned this Apr 20, 2017
@oleg-nenashev
Copy link
Member Author

Self-:bug:

@ghost
Copy link

ghost commented Apr 25, 2017

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

@oleg-nenashev
Copy link
Member Author

@reviewbybees @kohsuke Ready for review. I would especially appreciate feedback regarding CRT inclusion feasibility. Effectively it is required for fine-grain logging only, which I could disable for the release build (and maybe make it configurable via system property). OTOH, 40KB should not be a problem in 2017 since it needs to be loaded only once.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 from what little I understand of it. Probably @kohsuke is the only one able to do a deep review.

@@ -40,6 +40,10 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<argLine>-XX:+CreateMinidumpOnCrash</argLine>
<trimStackTrace>false</trimStackTrace>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh.

BOOL WINAPI KillProcessEx(IN DWORD dwProcessId, IN BOOL bTree);

// Sets bit 29 in order to keep the codes in the user space
#define reportErrorWithCode(env,code,msg) SetLastError(code + 0x10000000); error(env,__FILE__,__LINE__,msg);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using toSystemErrorCode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, because it is a native stuff. Ideally I should create enum there as well, but I firstly need to think about fatal/not-fatal errors (E.g. Process memory block unavailability is not fatal, and it is one of potential JENKINS-30782 root causes)

containsString("Failed to read " + getExpectedPEBName(false)),
containsString("error=299 at envvar-cmdline")));
assertThat(ex.getMessage(), containsString("Process with pid=" + pid + " has already stopped. Exit code is -1"));
assertThat(ex.getWin32ErrorCode(), equalTo(UserErrorType.PROCESS_IS_NOT_RUNNING.getSystemErrorCode()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@oleg-nenashev
Copy link
Member Author

@reviewbybees done

@oleg-nenashev oleg-nenashev mentioned this pull request May 5, 2017
4 tasks
@oleg-nenashev
Copy link
Member Author

@kohsuke said he is fine with CRT inclusion. @reviewbybees done => Merging

@oleg-nenashev oleg-nenashev merged commit 6731aa9 into jenkinsci:master May 5, 2017
@oleg-nenashev oleg-nenashev deleted the bug/issue29_native_diag branch May 5, 2017 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants