Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64831

illegal reflective access in remoting

    XMLWordPrintable

Details

    • 2.317

    Description

      I see the following exception after installing the selenium plugin. I know the plugin is not maintained anymore, but I'm not sure if the exception is caused by remoting.

       /usr/lib/jvm/java-11-openjdk-amd64/bin/java -cp /var/cache/jenkins/war/WEB-INF/lib/remoting-4.5.jar hudson.remoting.Launcher -cp /var/lib/jenkins/plugins/selenium/WEB-INF/lib/selenium-server-standalone-3.141.59.jar:/var/lib/jenkins/plugins/selenium/WEB-INF/lib/htmlunit-driver-standalone-2.33.3.jar -connectTo localhost:37677
      WARNING: An illegal reflective access operation has occurred
      WARNING: Illegal reflective access by hudson.remoting.Launcher (file:/var/cache/jenkins/war/WEB-INF/lib/remoting-4.5.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
      WARNING: Please consider reporting this to the maintainers of hudson.remoting.Launcher
      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
      Exception in thread "main" java.lang.IllegalArgumentException: object is not an instance of declaring class
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at hudson.remoting.Launcher.addClasspath(Launcher.java:154)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at io.jenkins.remoting.shaded.org.kohsuke.args4j.spi.MethodSetter.addValue(MethodSetter.java:47)
      	at io.jenkins.remoting.shaded.org.kohsuke.args4j.spi.StringOptionHandler.parseArguments(StringOptionHandler.java:19)
      	at io.jenkins.remoting.shaded.org.kohsuke.args4j.CmdLineParser.parseArgument(CmdLineParser.java:520)
      	at hudson.remoting.Launcher.main(Launcher.java:293)
      

      Attachments

        Issue Links

          Activity

            mbo Markus created issue -
            mbo Markus made changes -
            Field Original Value New Value
            Environment openjdk version "11.0.9.1" 2020-11-04
            Debian Buster 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux
            Jenkins 2.263.3
            openjdk version "11.0.9.1" 2020-11-04
            Debian Buster 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux
            timja Tim Jacomb made changes -
            Labels illegalReflectiveAccess illegalReflectiveAccess java11-compatibility
            jthompson Jeff Thompson added a comment -

            I can't remember but it might be related to the Selenium plugin. I remember something like that from a couple of years ago.

            It might also have something to do with running in Java 11, which I haven't tried very much.

            jthompson Jeff Thompson added a comment - I can't remember but it might be related to the Selenium plugin. I remember something like that from a couple of years ago. It might also have something to do with running in Java 11, which I haven't tried very much.
            mbo Markus added a comment -

            Yes, It's related to java 11, with java 8 it works. The question is if it's related to remoting-4.x.jar or selenium-server-standalone-3.141.59.jar. Should remoting work with java 11+ in general or are there any known issues?

            mbo Markus added a comment - Yes, It's related to java 11, with java 8 it works. The question is if it's related to remoting-4.x.jar or selenium-server-standalone-3.141.59.jar. Should remoting work with java 11+ in general or are there any known issues?
            jthompson Jeff Thompson added a comment -

            Remoting should work with Java 11, but there may be a few odd warning messages. Possibly including this one. I don't know if it is related to Remoting or Selenium.

            jthompson Jeff Thompson added a comment - Remoting should work with Java 11, but there may be a few odd warning messages. Possibly including this one. I don't know if it is related to Remoting or Selenium.
            martinjost Martin Jost added a comment -

            Note: I see a similar warning with JDK11 on RH7, but definitely w/o Selenium plugin: https://issues.jenkins.io/browse/JENKINS-65582

            "WARNING: Illegal reflective access by jenkins.slaves.StandardOutputSwapper$ChannelSwapper to constructor java.io.FileDescriptor(int)"

            So from my perspective, it is JDK11 <=> slave.jar. I'm as well using remoting 4.5.

            martinjost Martin Jost added a comment - Note: I see a similar warning with JDK11 on RH7, but definitely w/o Selenium plugin : https://issues.jenkins.io/browse/JENKINS-65582 "WARNING: Illegal reflective access by jenkins.slaves.StandardOutputSwapper$ChannelSwapper to constructor java.io.FileDescriptor(int)" So from my perspective, it is JDK11 <=> slave.jar. I'm as well using remoting 4.5.
            basil Basil Crow added a comment -

            What is calling hudson.remoting.Launcher with the -cp option? Its implementation assumes that the system classloader is a URLClassLoader, which isn't the case in Java 9 and later. In other words, this option just won't work in Java 11. I suggest the option simply be removed from Remoting, once all callers have been weaned off it.

            basil Basil Crow added a comment - What is calling hudson.remoting.Launcher with the -cp option? Its implementation assumes that the system classloader is a URLClassLoader , which isn't the case in Java 9 and later. In other words, this option just won't work in Java 11. I suggest the option simply be removed from Remoting, once all callers have been weaned off it.
            jglick Jesse Glick added a comment -

            https://github.com/jenkinsci/remoting/pull/468 would cover the originally reported case. The ChannelSwapper warning is different.

            jglick Jesse Glick added a comment - https://github.com/jenkinsci/remoting/pull/468 would cover the originally reported case. The ChannelSwapper warning is different.
            basil Basil Crow added a comment -

            The ChannelSwapper warning is different.

            Indeed. The ChannelSwapper warning is covered in JENKINS-65582.

            basil Basil Crow added a comment - The ChannelSwapper warning is different. Indeed. The ChannelSwapper warning is covered in JENKINS-65582 .
            jglick Jesse Glick added a comment -

            The ChannelSwapper warning could be eliminated by just deleting StandardOutputSwapper and StandardOutputStream. The risk is that poorly behaved plugins might have code which writes to System.out from a Remoting callable. If they do, and Remoting is using stdio mode (e.g. CommandLauncher), you could get sudden channel corruption.

            jglick Jesse Glick added a comment - The ChannelSwapper warning could be eliminated by just deleting StandardOutputSwapper and StandardOutputStream . The risk is that poorly behaved plugins might have code which writes to System.out from a Remoting callable. If they do, and Remoting is using stdio mode (e.g. CommandLauncher ), you could get sudden channel corruption.
            jglick Jesse Glick added a comment -

            I suppose this could be dealt with by having the stdio mode use a slightly more complicated protocol (new Channel.Mode?) whereby each packet is printed as text-ish with a distinctive or even random prefix and a trailing newline. Thus any unrelated messages printed to stdout would just be ignored.

            jglick Jesse Glick added a comment - I suppose this could be dealt with by having the stdio mode use a slightly more complicated protocol (new Channel.Mode ?) whereby each packet is printed as text-ish with a distinctive or even random prefix and a trailing newline. Thus any unrelated messages printed to stdout would just be ignored.
            jglick Jesse Glick made changes -
            Link This issue relates to JENKINS-65582 [ JENKINS-65582 ]
            markewaite Mark Waite added a comment -

            Remoting 4.11 is included in Jenkins 2.317. Remoting 4.11 removes the -cp argument from the remoting command line.

            markewaite Mark Waite added a comment - Remoting 4.11 is included in Jenkins 2.317. Remoting 4.11 removes the -cp argument from the remoting command line.
            markewaite Mark Waite made changes -
            Released As 2.317
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]

            People

              jthompson Jeff Thompson
              mbo Markus
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: