You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@linkis.apache.org by "guoshupei (via GitHub)" <gi...@apache.org> on 2023/02/06 10:21:05 UTC

[GitHub] [linkis] guoshupei commented on issue #4153: [Bug] Linkis gateway throw 500 Server Error

guoshupei commented on issue #4153:
URL: https://github.com/apache/linkis/issues/4153#issuecomment-1418844487

   The root cause is that the ribbon's ServerList is not refreshed in time
   
   First,  you can add default handling of `super.choose(serviceInstance.getApplicationName, hint)`
   
   ```
         override def choose(serviceId: String, hint: Any): client.ServiceInstance = {
           if (isMergeModuleInstance(serviceId)) {
             val serviceInstance = getServiceInstance(serviceId)
             logger.info("redirect to " + serviceInstance)
             val lb = this.getLoadBalancer(serviceInstance.getApplicationName)
             val serverOption =
               lb.getAllServers.asScala.find(_.getHostPort == serviceInstance.getInstance)
             if (serverOption.isDefined) {
               val server = serverOption.get
               new RibbonLoadBalancerClient.RibbonServer(
                 serviceId,
                 server,
                 isSecure(server, serviceId),
                 serverIntrospectorFun(serviceId).getMetadata(server)
               )
             } else {
               logger.warn("RibbonLoadBalancer not have Server, execute default super choose method" + serviceInstance)
               super.choose(serviceInstance.getApplicationName, hint)
             }
           } else super.choose(serviceId, hint)
         }
   ```
   
   Second, you can shorten the refresh time in `application-linkis.yml`, default 30s
   
   ```
   ribbon:
     ServerListRefreshInterval: 10000
       
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org