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

Test Connection fails with Rocket.Chat API 1.1.0

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • - Rocketchat version: 0.57.1
      - Rocket chat plugin version: 1.1.0
      - Jenkins version : 2.60.1

    Description

      "Test connection" on the Configure System page fails with this client error:

      Client error - Could not send message

      Client error - Could not send message
      java.net.ConnectException: Connection timed out (Connection timed out)
      	at java.net.PlainSocketImpl.socketConnect(Native Method)
      	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
      	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
      	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
      	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      	at java.net.Socket.connect(Socket.java:589)
      	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
      	at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:542)
      	at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:412)
      	at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:179)
      	at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
      	at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:134)
      	at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:612)
      	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:447)
      	at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:884)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
      	at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:138)
      Caused: com.mashape.unirest.http.exceptions.UnirestException
      	at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:143)
      	at com.mashape.unirest.request.BaseRequest.asJson(BaseRequest.java:68)
      	at jenkins.plugins.rocketchatnotifier.rocket.RocketChatBasicCallAuthentication.doAuthentication(RocketChatBasicCallAuthentication.java:46)
      Caused: java.io.IOException: Please check if the server API https://rocketchat-dsr-db.tk/api/v1/login is correct: java.net.ConnectException: Connection timed out (Connection timed out)
      	at jenkins.plugins.rocketchatnotifier.rocket.RocketChatBasicCallAuthentication.doAuthentication(RocketChatBasicCallAuthentication.java:48)
      	at jenkins.plugins.rocketchatnotifier.rocket.RocketChatClientCallBuilder.buildCall(RocketChatClientCallBuilder.java:91)
      	at jenkins.plugins.rocketchatnotifier.rocket.RocketChatClientCallBuilder.buildCall(RocketChatClientCallBuilder.java:81)
      	at jenkins.plugins.rocketchatnotifier.rocket.RocketChatClientImpl.getChannels(RocketChatClientImpl.java:91)
      	at jenkins.plugins.rocketchatnotifier.RocketClientImpl.<init>(RocketClientImpl.java:30)
      	at jenkins.plugins.rocketchatnotifier.RocketChatNotifier$DescriptorImpl.doTestConnection(RocketChatNotifier.java:397)
      	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
      	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
      	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
      	at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
      	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:80)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:92)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      	at org.eclipse.jetty.server.Server.handle(Server.java:499)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
      	at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

       
      On the same maschine a test with a standard user and curl was successfull.

      {
        "status": "success",
        "data": {
          "authToken": "tVk0fAFfFPktxTJh37CR9E63fv_na9FFkMmFRcBMspZ",
          "userId": "C7sF6XBjNZWkoqoM6"
        }
      }
      

      Please note: The jenkins server is behind a proxy.

      But with user jenkins curl failed (no proxy setting in jenkins environment, this technical user hasn't a bash)

      sudo -u jenkins curl https://<myAddress>/api/v1/login -d "user=<myUser&password=<myPassword>"
      

      If I use the -E option curl is successfull (because the proxy settings are taken).

      A proxy is set in the advanced plugin settings in jenkins.

      Attachments

        Issue Links

          Activity

            svamie Sven Miersch created issue -

            seems like the proxy settings are not used by the plugin, but that's strange as I set it explicitly here 

            Is the jenkins server having the proxy settings configured in system settings?

            mreinhardt Martin Reinhardt added a comment - seems like the proxy settings are not used by the plugin, but that's strange as I set it explicitly here   Is the jenkins server having the proxy settings configured in system settings?
            svamie Sven Miersch added a comment - - edited

            Thanks for the reply.

            I tried a lot:

            First, I have configured the Proxy in Manage Jenkins > Manage Plugins > Advanced.

            I can't find the env entries for proxy setting if I read out the Environment variables (sh 'printenv' in pipeline script).

            Is there an other way to configure a Proxy in system settings?

             

            Second, (all of the following tries are as pipeline scripts) I have set two variables (http_proxy and https_proxy) in the system configuration (Manage Jenkins > Configure Jenkins > Configure System).
            I read out the Environment variables in the pipeline script with

            sh 'printenv'

            The environment variables were now available.

             

            And the next try I have set the Environment variables in pipeline script directly:

                        environment {
                            HTTP_PROXY = 'http://xx:1234'
                            HTTPS_PROXY = 'http://xx:1234'
                        }
            	    rocketSend channel: 'xx', message: 'bla'
            

             

            After that I had the idea to set the os system environments

                        sh '''#!/bin/bash
                             export HTTP_PROXY=http://xx:1234
                             export HTTPS_PROXY=http://xx:1234
                        '''
            	    rocketSend channel: 'xx', message: 'bla'
            

             

            All of them don't work.

            svamie Sven Miersch added a comment - - edited Thanks for the reply. I tried a lot: First, I have configured the Proxy in Manage Jenkins > Manage Plugins > Advanced . I can't find the env entries for proxy setting if I read out the Environment variables (sh 'printenv' in pipeline script). Is there an other way to configure a Proxy in system settings?   Second, (all of the following tries are as pipeline scripts) I have set two variables (http_proxy and https_proxy) in the system configuration ( Manage Jenkins > Configure Jenkins > Configure System ). I read out the Environment variables in the pipeline script with sh 'printenv' The environment variables were now available.   And the next try I have set the Environment variables in pipeline script directly: environment { HTTP_PROXY = 'http://xx:1234' HTTPS_PROXY = 'http://xx:1234' } rocketSend channel: 'xx', message: 'bla'   After that I had the idea to set the os system environments sh '''#!/bin/bash export HTTP_PROXY=http://xx:1234 export HTTPS_PROXY=http://xx:1234 ''' rocketSend channel: 'xx', message: 'bla'   All of them don't work.
            mreinhardt Martin Reinhardt made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-48841 [ JENKINS-48841 ]
            mreinhardt Martin Reinhardt added a comment - You can try this hpi here:  https://martinreinhardt-online.de/jenkins/job/rocketchatnotifier-plugin/job/bugfix%252Fproxy_settings/2/artifact/target/
            mreinhardt Martin Reinhardt made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            mreinhardt Martin Reinhardt made changes -
            Status In Progress [ 3 ] Open [ 1 ]

            Fixed in Version 1.1.1

            mreinhardt Martin Reinhardt added a comment - Fixed in Version 1.1.1
            mreinhardt Martin Reinhardt made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            svamie Sven Miersch added a comment -

            Thank you. Perfect Job.
            What did you changed?

            svamie Sven Miersch added a comment - Thank you. Perfect Job. What did you changed?

            People

              mreinhardt Martin Reinhardt
              svamie Sven Miersch
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: