-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
[JENKINS-51913] Prevent archiveArtifacts from dumping a stacktrace when empty results are allowed #4913
Conversation
I would generally argue that this stacktrace is always pointless, an error should be fine but 🤷 |
Agreed that it needs a test to assert that the stack trace message is not generated when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like it would be safer and better to catch InterruptedException
. Not sure what this has to do with allowEmptyArchive
in fact.
@jglick So from my digging it seemed that the main exception the underlying library throws is an intentional for when no artifacts are found. Which is why i took this approach. I do agree that it would introduce a specific situation where if some other exception was thrown, but allow empty was set, then it would hide the exception. This was just my attempt to get a 2 year old issue that my team ran into moving.. I'm totally open to recommendations. I'm not much of a java dev :D |
I think this buglet was introduced by #3265 and it does not really have anything to do with the try {
// …
} catch (InterruptedException e) {
listener.getLogger().println(e.getMessage()); // (in case it is something like "no matches found within 10000")
} catch (Exception e) { // (as before)
Functions.printStackTrace(e, listener.getLogger());
} But better would be to improve jenkins/core/src/main/java/hudson/FilePath.java Line 2875 in e3b17ef
InterruptedException which ArtifactArchiver could treat specially: the current code will also throw InterruptedException for unrelated reasons that might merit a stack trace, such as an agent connection being closed unexpectedly.
More broadly, anyone encountering this sort of issue is advised to improve their build to either specify a narrower file pattern that does not require as much searching, or to have regular build steps actually move or copy desired files into a dedicated archive directory so that no pattern whatsoever is needed (or just a trivial one like |
@gregswift did you have the opportunity to review @jglick 's feedback? Also adding a test would be great. |
Sorry.. did review the feedback.. have not gotten a chance to get back to this. |
@gregswift do you know if you will have some bandwidth to work on this in the future? If not, I'd like to add the |
ahh damn. sorry. i've changed jobs and totally spaced on this. If you don't hear from me within a week or so go ahead and add the |
@jglick Given that you have already evaluated the cause of this problem and provided a partial solution in #4913 (comment), might I be able to interest you in giving this kind contributor a carry by completing the original effort? The contributor appears to have moved on, but the patch seems largely viable and just needs some edits. I think it would be a low effort to complete this patch on behalf of the original contributor, and I think the result would be a valuable fix for a years-old annoyance. If, on the other hand, this is asking too much, then feel free to disregard this message and we will likely (tragically) close this pull request due to inactivity in the next week or so. |
To summarize:
We have pinged both Greg Swift and Jesse Glick to see if either of them have an interest in moving forward with the action item from this PR. Since it has been a week since the On behalf of the core team, I would like to thank Greg Swift and Jesse Glick for their contributions. Even though this PR did not make it across the finish line, it was a promising start! I continue to encourage you (or anyone else who is interested!) to pick up this effort and drive it to completion. Users have been annoyed with this behavior for years, and a fix at some point in the future would be highly appreciated! Thanks again. |
@basil I wasn't sure if i'd get to it, but I have just pushed some changes to my branch. It doesn't seem to show here (which is fine). If yall wanna try re-opening it and letting the tests run I can continue verify them and then I will ask for a re-review? |
The reopen button is grayed out for me with the reason "the |
thats an interesting change to github i haven't experienced before but i can see why its a thing 🤷 so much for cleaning up my work before reopening the PR :D |
See JENKINS-51913.
Testing
Not sure best approach on this, but my guess would be to add an assertion to this test that verifies that the string
java.lang.InterruptedException: no matches found within
is not in the output?Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Proposed changelog entries
section only if there are breaking changes or other changes which may require extra steps from users during the upgradeDesired reviewers
Maintainer checklist
Before the changes are marked as
ready-for-merge
:Proposed changelog entries
are correctupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate
to be considered (see query).