All Products
Search
Document Center

Enterprise Distributed Application Service:Error code: HSF-0024

Last Updated:Mar 10, 2026

High-speed Service Framework (HSF) supports Groovy-based routing rules that direct service calls to specific provider instances. Error code HSF-0024 means a routing rule is not taking effect -- calls reach an unintended instance or ignore the rule entirely.

Quick diagnosis

Match your symptom to the most likely cause:

SymptomLikely causeGo to
Rule has no effect at allConsumer uses a local call or generic call, bypassing routing logicStep 1
Rule works in general but not for a specific serviceConsumer may not have received the rule from DiamondStep 2
Parse route rule error in logsGroovy syntax or structure errorStep 3
Rule received and parsed, but traffic goes elsewhereDestination IP missing from providers list, incorrect rule logic, or address priority conflictStep 4
Everything looks correct, but the expected instance never receives trafficTarget method is never called, or the closure returns an unexpected keyStep 5

Log files

All troubleshooting steps reference hsf.log. Locate it based on your HSF version:

HSF versionLog path
HSF 2.2${user.home}/logs/hsf/hsf-config.log
HSF 2.1${user.home}/logs/hsf/hsf.log

Step 1: Verify the call mode

Local calls and generic calls bypass the routing rule engine entirely. If the consumer uses either mode, routing rules have no effect.

Local call mode

When a process acts as both the service provider and the service consumer, HSF defaults to in-process Java calls instead of remote procedure calls (RPCs). Because no RPC occurs, the routing rule logic is never invoked.

Generic call mode

In generic call mode, the consumer invokes GenericService directly to describe the service without depending on the service's second-party package. Because HSF has no loaded service class in this mode, it cannot run the routing rule's service logic.

Note: The service test function in HSFOPS uses generic calls. Routing rules do not take effect when you test services through HSFOPS.

If the consumer uses standard RPC calls and the rule still has no effect, proceed to Step 2.

Step 2: Confirm the consumer received the rule

HSF stores routing rules in Diamond. When a consumer starts, it pulls the routing rules for each consumed service from Diamond.

Search hsf.log for the target service name. A successful pull produces a log entry similar to:

2015-10-09 13:20:06.402 WARN [com.taobao.diamond.client.Worker.default:t.hsf] [] [] [] [Metadata Component] Received rule for service [com.alibaba.dt.op.authclient.api.ResourceAPI:1.0.0.daily]: Groovy_v200907@package hqm.test.groovy
public class RoutingRule{
    Map<String, List<String>> routingRuleMap(){
        return [
            "G1":["100.69.161.201:*"]
        ]
    }

    String interfaceRoutingRule(){
        return "G1";
    }
}

Look for the keyword [Metadata Component] Received rule for service followed by your service name.

If no matching log entry exists, check the following:

  1. Rule-to-service name mismatch -- Verify that the routing rule name in Diamond matches the fully qualified service name (interface name + version).

  2. Environment mismatch -- Confirm that the Diamond environment where the rule is configured matches the consumer's runtime environment.

Step 3: Confirm the rule parsed successfully

After receiving the rule, HSF parses the Groovy script. Search hsf.log for the service name. A successful parse produces a log entry similar to:

2015-10-09 13:20:06.761 INFO [com.taobao.diamond.client.Worker.default:t.hsf] [] [] [] Parse route rule successed, RouteRule:com.taobao.hsf.route.service.RouteRule@4441ec5a{
keyedRules={G1=[100.69.161.201:*]},
interfaceRule=G1,
methodRule={},
argsRule={}
}

Look for the keyword Parse route rule successed.

If parsing fails, the log contains an error with details about the Groovy syntax or structural issue. Review the error against the routing rule structure reference below.

Routing rule structure reference

An HSF routing rule is a Groovy class with these methods:

MethodReturn typePurpose
routingRuleMap()Map<String, List<String>>Defines named groups of provider IP addresses
interfaceRoutingRule()StringReturns the group key for interface-level routing
argsRoutingRule(String methodName, String[] paramTypeStrs)Object (closure)Returns a closure that selects a group key based on method arguments

Step 4: Validate the rule and address resolution

If the rule was received and parsed correctly, the problem lies in the rule logic or the address resolution process. Check these areas in order.

4a. Verify the destination instance provides the service

Query the service on the HSF service governance platform in the target environment. Confirm that the IP addresses in your routing rule appear in the providers list.

Behavior by HSF version:

  • Earlier versions of HSF: If the IP address in the routing rule does not provide the service, HSF returns an error indicating that the address cannot be found.

  • HSF 2.1.0.7 and later: If the IP address specified by the routing rule does not provide services, the system prompts you to enable empty protection. In this case, the routing rule does not take effect, and HSF selects an available IP address from the providers list stored in Config Server.

To check whether empty protection triggered when a method-based route is used, search hsf.log for the service name. Look for this pattern:

2015-10-09 13:20:06.761 WARN [HSF-AddressAndRule-2-thread-1:t.hsf] [] [] [] [Address Component] isEmptyProtection: true
2015-10-09 13:20:06.761 WARN [HSF-AddressAndRule-2-thread-1:t.hsf] [] [] [] [Address Component] newAllAvailableAddresses is empty for service : com.alibaba.dt.op.authclient.api.ResourceAPI:1.0.0.daily
2015-10-09 13:20:06.761 INFO [HSF-AddressAndRule-2-thread-1:t.hsf] [] [] [] [AddressBucket-com.alibaba.dt.op.authclient.api.ResourceAPI:1.0.0.daily] Refresh: all amount [0], available amount [0], local preferred switch [off].Unit=UNIT
2015-10-09 13:20:06.761 INFO [HSF-AddressAndRule-1-thread-1:t.hsf] [] [] [] [Address Component] route result com.alibaba.dt.op.authclient.api.ResourceAPI:1.0.0.daily, addresses remain[1], EmptyProtection triggered [true]
2015-10-09 13:20:06.762 INFO [HSF-AddressAndRule-1-thread-1:t.hsf] [] [] [] [AddressBucket-com.alibaba.dt.op.authclient.api.ResourceAPI:1.0.0.daily] Refresh: all amount [1], available amount [1], local preferred switch [off].

EmptyProtection triggered [true] is the key indicator. It means the routing rule resolved to an empty address list, so HSF fell back to the full providers list.

Resolution: Correct the IP address in your routing rule to match an active provider, or add the target instance to the providers list.

4b. Verify the rule logic

Confirm that the interface route, method route, and parameter route return the correct group keys from routingRuleMap().

4c. Understand address calculation priority

HSF resolves addresses through a layered intersection process. If the same-IDC (Internet data center) rule is active, it takes precedence over routing rules -- the routing rule operates within the address set already filtered by the same-IDC rule.

Routing rule priority (descending):

  1. Interface routing -- The result of interfaceRoutingRule() (regex match) intersects with the same-IDC address set.

  2. Method routing -- The result of methodRoutingRule() (regex match) intersects with the interface routing result.

  3. Parameter routing -- The result of argsRoutingRule() (regex match) intersects with the method routing result.

If a routing level is undefined (returns null or the key does not exist in routingRuleMap), that level imposes no restriction. The full address set from the previous level passes through.

Step 5: Verify the rule executes at runtime

If all preceding steps pass, confirm that the target service method is actually called. If the method in the routing rule is never invoked, the rule never runs.

Add System.out.println() statements inside the routing rule to trace execution. For argsRoutingRule, the return value must be a closure. Example:

Groovy_v200907@package hqm.test.groovy
public class RoutingRule {
    Map<String, List<String>> routingRuleMap() {
        return [
            "BSeller_address_filter_Key":["10.177.75.54:*"],
            "ASeller_address_filter_Key":["10.97.94.33:*"]
        ]
    }

    Object argsRoutingRule(String methodName, String[] paramTypeStrs) {
        if (methodName.startsWith("checkUrlPermission")) {
            System.out.println("Match the checkUrlPermission method.");
            return {
                Object[] args ->
                if(args[1] % 2 == 1 ) {
                    System.out.println("Route to BSeller_address_filter_Key");
                    return "BSeller_address_filter_Key.";
                } else {
                    System.out.println("Route to ASeller_address_filter_Key");
                    return "ASeller_address_filter_Key." ;
                }
            }
        }
    }
}

Check the consumer's standard output for the printed messages. If no output appears, the method name does not match, or the method is never called.