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

(maint) Update clj-parent to 5.1.1; fips config; dynapath; fix core reflection #94

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

rbrw
Copy link

@rbrw rbrw commented Aug 1, 2022

I started this because I'd noticed what looked like notable reflection cost in some pdb flame graphs while working on escalations, and I thought it'd be easy to fix. Several yaks later, this pr.

It also turned out that I'd misread the graph, and that further down, the real culprit was the i18n reflection problem that we've fixed in newer versions, so we don't have to keep the status-core reflection fixes, but I thought they might be worthwhile since they're fairly straightforward and not too noisy.

See the individual commit messages for specific details.

rbrw added 6 commits August 1, 2022 16:06
Exception in thread "main" java.lang.IllegalArgumentException: Must
hint overloaded method: toArray,
compiling:(flatland/ordered/set.clj:19:1)
Fixes

  Execution error (ClassNotFoundException) at
  java.net.URLClassLoader/findClass (URLClassLoader.java:476).
  org.bouncycastle.asn1.x500.X500Name
Previously lein test would produce:

  WARNING: An illegal reflective access operation has occurred
  WARNING: Illegal reflective access by dynapath.defaults$eval29028$fn__29029 to method java.net.URLClassLoader.addURL(java.net.URL)
  WARNING: Please consider reporting this to the maintainers of dynapath.defaults$eval29028$fn__29029
  WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
  WARNING: All illegal access operations will be denied in a future release
For example, hashing and equality are blocking operations (they
require network lookups).  From
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html#equals(java.lang.Object):

  Since hosts comparison requires name resolution, this operation is a
  blocking operation.
I originally did this because I misread a flame graph and thought I
was seeing notable reflection in tk status, but only afterward did I
realize it was actually, lower down, just that i18n reflection problem
we've already fixed.

Since the changes were trivial, might be worth keeping.
@rbrw rbrw requested a review from a team as a code owner August 1, 2022 21:40
Fixes:

  ERROR in (auth-service-ssl-status-endpoint-test) (SSLIOSession.java:265)
  Uncaught exception, not in assertion.
  expected: nil
    actual: javax.net.ssl.SSLException: java.lang.IllegalArgumentException: TLSv1.3
Copy link
Contributor

@mwaggett mwaggett left a comment

Choose a reason for hiding this comment

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

The changes mostly look good to me!
Some of the commit messages could be clearer though, in my opinion:

  • The thing: actual change format is a bit weird to me. I find it clearer to say something like Made change in thing. Does that make sense?
  • The multi-line error commit could use a little more info - the behavior of what changed? when?
  • I would find it useful for the reflection commit to explain why the change is still worthwhile, but that could just be me not knowing anything about reflection.

@@ -16,6 +16,7 @@
:dependencies [[org.clojure/clojure]

[cheshire]
[org.tcrawley/dynapath "1.0.0"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like we have this in clj-parent: https://github.com/puppetlabs/clj-parent/blob/7d37cd237cbbe8e93b461483b1d95c286829800c/project.clj#L91

Should we just bump the version there?

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure, I think maybe Austin told me that there was some existing issue with puppetserver that would break if we did, and the fix hasn't been prioritized yet? It's currently also pinned in pdb, to fix the same issue, fwiw.

@rbrw
Copy link
Author

rbrw commented Aug 29, 2022

The changes mostly look good to me! Some of the commit messages could be clearer though, in my opinion:

* The `thing: actual change` format is a bit weird to me. I find it clearer to say something like `Made change in thing`.

Ahh, don't feel strongly about it, but I'm used to using either in various projects, and I sometimes favor the former to either preserve space on the summary line, or to keep a series of related changes to a given subsystem easier to spot in a git log --oneline --decorate --graph or similar.

* The multi-line error commit could use a little more info - the behavior of what changed? when?

Hmm, which one? You mean the .toArray fix? If so, that was just a bug in ordered with respect to, and if I recall correctly, newer clojure and/or jdk versions (not sure of the precise details offhand, but I can do some research if we'd like -- just recalled addressing it in pdb a while back, so I knew what to do).

* I would find it useful for the reflection commit to explain why the change is still worthwhile, but that could just be me not knowing anything about reflection.

It's mostly just that reflection can be very expensive if it's ever involved in fine-grain enough use (the canonical example might be a tight loop), and so it's never desirable, but the annotations add "noise"/maint, and so might not be worth it if there are a lot of them in code that's always coarse grain. Here the changes were trivial enough that I was leaning toward "won't hurt, might help", since I'd already done them, but I can just drop that commit if we prefer.

(java.util.concurrent CancellationException)
(java.lang.management ManagementFactory)
(javax.management ObjectName)
(clojure.lang IFn)))


(set! *warn-on-reflection* true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want this turned on in the shipping code?

Copy link
Author

Choose a reason for hiding this comment

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

No strong opinion - I'd been thinking that either we'd keep the file clean now that it's clean, or, we'd decide we didn't want to at some point later, and we'd remove the line then. I don't think it should have any affect in production otherwise, offhand?

Copy link
Author

Choose a reason for hiding this comment

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

(Oh, and to be clear, also happy to just take that out.)

@mwaggett
Copy link
Contributor

mwaggett commented Oct 7, 2022

@rbrw Is this something you're still interested in landing? If so, it could use some updates to the clj-parent version and the bouncycastle jdk15on -> jdk18on change.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants