Fork me on GitHub
#clojure-dev
<
2018-10-06
>
bhauman22:10:51

Hmmm the .getMethod patch in this commit https://github.com/clojure/clojure/commit/7a6f5527c24b16b9f896725defa538b8e3fd7d28 is causing figwheel-main to fail, I traced it to the hawk library, https://github.com/wkf/hawk/issues/22

bhauman22:10:22

but unfortunately I noticed a bunch of other wonkyness while I was looking for it

alexmiller22:10:20

very interested to learn more. particularly, which jdk are you using when you see the issue? (or which ones exhibit the problem)

bhauman22:10:41

JDK 1.8 works

bhauman22:10:53

JDK 10 is the problem

alexmiller22:10:55

should be no change in behavior for 1.8 so that’s good :)

alexmiller22:10:14

if you turn on *warn-on-reflection* can you tell which reflective call it’s doing?

alexmiller22:10:07

would also be interested in what you see on java 9 (I did manual tests on 8, 9, 10, and 11 with the change but of course there are lots of cases I didn’t test)

bhauman22:10:14

I’ll look inside hawk and see if there is an obvious cause

bhauman22:10:08

I was unable to install java 9 to my satisfaction so … not an easy test for me

alexmiller22:10:42

looks like a ton of interop in hawk as its all file / watch api stuff

alexmiller22:10:02

having written very similar stuff and made it reflection-free, it’s tedious

bhauman22:10:21

so it’s only reflection calls that cause this?

bhauman22:10:35

that makes sense

alexmiller22:10:37

yes, the change is entirely in the reflector

bhauman22:10:15

its because of non-deterministic method order?

alexmiller22:10:19

I would also try using --illegal-access=deny on your jvm - that may exhibit different behavior

alexmiller22:10:34

the patch does not change anything wrt method order

bhauman22:10:39

apparently there are more problems than just hawk

bhauman22:10:11

So you are saying the best way to help is to provide specific instances of failure

alexmiller22:10:40

I think understanding a specific case that is different would help me understanding the general issue

alexmiller22:10:14

when reflecting, the method search is based on the type of the target object (since it’s reflective, that’s the only type we know). If a method is found that is not accessible (canAccess=false), then the new code looks for the same method in parent super classes to find the same method at a higher point that is accessible. Here “accessible” can mean multiple things but the primary case we care about is module accessibility.

alexmiller22:10:11

I’ve tested a number of cases. clearly this is something that I didn’t think of.

alexmiller22:10:23

so having specific case would be illuminating

bhauman22:10:11

So i’d be looking for an overriden method

bhauman22:10:35

OK I’ll check illegal-access

bhauman22:10:00

hmmm what about compareTo

alexmiller22:10:04

I think warn-on-reflection would be most useful

bhauman22:10:10

yeah I set that

alexmiller22:10:14

as it will report when using reflectin

alexmiller22:10:38

compareTo on what type?

bhauman22:10:48

isFile, isDirectory, getParentFile, toPath, startsWith, compareTo, interrupt, join

bhauman22:10:52

are the methods

bhauman22:10:58

in hawk that are reported

bhauman22:10:08

Not sure what type yet

alexmiller22:10:11

what are you seeing when you use it though?

bhauman22:10:35

zero errors, just behavior failure

alexmiller22:10:38

prob not interrupt or join - those are on threads

alexmiller22:10:49

I assume someone is swallowing the likely exception somewhere

bhauman22:10:56

isFile works and warns on reflection

bhauman22:10:26

I’m going to assume that isDirectory is the same but I’m going to look at the usage more closely now

alexmiller22:10:33

startsWith is interesting as it’s a default method on the interface and that’s one case I think might not be getting handled

alexmiller22:10:16

startsWith on Path that is (also exists on String but I think it’s Path here)

alexmiller22:10:21

oh, I have a repro

alexmiller22:10:59

(def p (java.nio.file.Paths/get "src" (into-array String []))) (.startsWith p "s") -> infinite loop

alexmiller22:10:42

ok, I can take it from here

alexmiller22:10:03

so no exception, it’s just pegging the watcher thread

bhauman22:10:36

OK great!!!

alexmiller22:10:24

thanks for blindly stumbling into it! :)

bhauman22:10:03

btw big thanks to @rpkn for pointing this out to me

alexmiller22:10:41

yeah, he messaged me too