Skip to content

[Bug][High] SQL ticket auto-execution always fails with IndexOutOfBoundsException "Index 1 out of bounds for length 1" (Api fetchDsConfig failed) #360

Description

@congshenV

Summary

Executing any SQL change ticket fails at session-creation stage. The scheduling log shows:

创建数据库连接失败,失败消息:Receive failed response from remote server. MsgContent is : Api fetchDsConfig failed, IndexOutOfBoundsException: Index 1 out of bounds for length 1
Request id is 6cc50579-2589-4f23-98bb-8d0b971d1fe6

Reproduced on Redis, PostgreSQL, and MySQL data sources, so it is data-source-agnostic — the failure happens before any database connection is opened.

Deployment: distributed, console + sidecar (two services connected over RSocket/TCP).


Root cause (with code references)

ConfigRService (backend/.../cgdm-api/.../console/configs/ConfigRService.java) declares two overloaded RPC methods:

DataSourceConfig fetchDsConfig(long dsId);                                // used by AutoExecJob (SQL ticket)
List<ConfigData> fetchDsConfig(String instanceId, List<String> names);    // added for SSL lazy config, used by SslConfigManager

The RPC framework routes by method name only: interfaceFullName + "." + methodName (DmClientRSocketApiProxy#getMethodFullNameForSend), ignoring the signature. The two overloads therefore collide on the same route key. RSocketApiManager.scanAllApiAndRegister registers only one of them — which one wins depends on the JVM's Class.getMethods() return order (it also logs a "Register duplicated name method" warning).

On the console side, MainRequestDispatcher dispatches by the registered method's parameter count and then loops paramJsonValues.get(i). When the worker sends the 1-argument fetchDsConfig(dsId) but the console has the 2-argument variant registered, get(1) throws IndexOutOfBoundsException: Index 1 out of bounds for length 1.

Flow: AutoExecJob.run() (L129) → ConfigRService.fetchDsConfig(dsId) → console MainRequestDispatcherIndexOutOfBoundsExceptiongenerateFailBackResult (Api fetchDsConfig failed, ...) → DmClientRSocketApiProxy (Receive failed response from remote server).


Why it looks intermittent / affects all datasources

  • Which overload gets registered is JVM-order dependent, so the outcome can differ per restart and per node.
  • The RPC exception happens before connection creation, so it is independent of the target database type.
  • Standalone (app.mode=embedded) deployments are unaffected because RSocket is skipped entirely in that mode — this bug only surfaces in distributed console + sidecar deployments.

Proposed fix (minimal)

Give the lazy config-value lookup a unique method name, e.g. fetchDsConfigByInstanceIdAndNames, updating ConfigRService, ConfigRServiceProvider, and the sidecar caller SslConfigManager. PR #330 aimed exactly at this but was closed without merging; its description records the same "argument-count mismatch caused by an overloaded RPC route" and verified that removing the overload eliminates the IndexOutOfBoundsException.


Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions