Skip to content

Three of the eight surfaces that open a list queries entry record no client on it, so MCP, /ws insert and Gremlin work lists with no address: it can be stopped but not attributed #9962

Closed

Description

@ruispereira

Summary

RunningQuery.setConnection states what the field is for:

Records which client connection runs the statement, for the listing: connectionId in the protocol's own terms
(the Postgres backend pid a pg_cancel_backend takes, a Bolt connection), and the client's address.

ServerControlPlane.listQueries publishes it through RunningQuery.toJSON, which writes connectionId and
clientAddress only when they are set, so an entry that never recorded them lists without the fields rather than
with empty ones. The same two fields are the 2nd and 3rd columns of SHOW TRANSACTIONS
(CypherTransactionsCommand:152), which prints "" for them.

Five surfaces record it. Three do not, and two of the three are HTTP surfaces that bypass the very helper their own
server already uses: AbstractServerHttpHandler.registerRunningQuery opens the entry of an HTTP request and sets
setConnection(null, String.valueOf(exchange.getSourceAddress())) on it unconditionally. The MCP endpoint and the
/ws insert session are served by that same HTTP server, but each opens its own entry further in, where that line
was not carried over.

The consequence is the question list queries is read to answer. A server at its admission limit shows entries whose
only identification is a user name and a protocol. For http, postgres, bolt, redis and mongodb the address
says which client; for mcp there is nothing at all, which is the worst of the three because an MCP deployment
typically runs ONE service principal for every agent connected to it, so the user name does not separate them either.
For ws there is a sessionId, but only in transactionMode: "none"; the three server-managed modes that #9838
just brought into the listing pass externalTransactionId == null, so those entries carry neither a session id nor
an address.

The rule that is broken: an entry in the listing identifies the work AND the client that asked for it, which is
written down on the setter and held by five of the eight surfaces.

Where (HEAD 5100e4b)

server/src/main/java/com/arcadedb/server/http/handler/AbstractServerHttpHandler.java:2082 - the one that does it,
and that the two HTTP siblings below do not reach

    runningQuery.setStatement(null, exchange.getRequestMethod() + " " + exchange.getRequestPath());
    runningQuery.setConnection(null, String.valueOf(exchange.getSourceAddress()));

mcp/src/main/java/com/arcadedb/mcp/MCPDispatcher.java:371

    final RunningQuery entry = server.getRunningQueries().register(textMember(args, "database"), user.getName(), "mcp", null, null);

grep -rn setConnection mcp/src is empty. The address is one call away on the HTTP transport
(MCPHttpHandler.execute holds the HttpServerExchange); the dispatcher is transport-neutral by design, which is
exactly why the field was not carried in, so the address has to arrive as a dispatcher field set by each transport.

server/src/main/java/com/arcadedb/server/http/ws/insert/WebSocketInsertSession.java:475

    final RunningQuery entry = runningQueries.register(databaseName, user.getName(), "ws", externalTransactionId,
        externalSession != null ? externalSession.getTag() : null);
    entry.setStatement("ws", () -> "insert chunk " + chunkSeq + " of session " + id + " (" + options.transactionModeName() + ")");

The session holds its WebSocketChannel (:156, with getChannel() at :227), so the peer address is available
on the same object.

gremlin/src/main/java/com/arcadedb/server/gremlin/ArcadeGraphManager.java:452

      final RunningQuery runningQuery = server.getRunningQueries().register(databaseOf(msg), USER.get(), "gremlin", null, null);

engine/src/main/java/com/arcadedb/query/RunningQuery.java:491 - where an unset field simply disappears

    if (connectionId != null)
      json.put("connectionId", connectionId);
    if (clientAddress != null)
      json.put("clientAddress", clientAddress);

Repro

Not run: the observable is the body of list queries while a tool call is in flight. The shortest check is an
assertion in whichever MCP test already drives a query tool call through the HTTP transport: take
server.getRunningQueries().getRunning() from a second thread while the call runs and assert
getClientAddress() != null. Today it is null. The counter-case is already pinned for the protocols that do record
it, which is what makes the gap visible when the two are read together.

FAMILY: the surfaces that open a list queries entry

surface opens the entry at records the client what the listing can identify
HTTP (every /api/v1 route) AbstractServerHttpHandler.registerRunningQuery:2082 yes, source address user, address, method and path
PostgreSQL PostgresNetworkExecutor:392 yes, backend pid + address and pg_cancel_backend takes the pid
Bolt BoltNetworkExecutor:889 yes, connection id + address user, connection, address
Redis RedisNetworkExecutor:346 yes, executor name + address user, connection, address
MongoDB MongoDBBackend:168 yes, channel id + address user, channel, address
MCP MCPDispatcher.registerRunningQuery:371 no user (usually one service principal) and "mcp"
/ws insert WebSocketInsertSession.openChunkEntry:475 no the session id in the statement text; no address
Gremlin Server ArcadeGraphManager.beforeQueryStart:452 no user and "gremlin"

Suggested fix

The missing piece is one line each, but the reason all three missed it is that register(...) takes five arguments
and the client is not among them, so recording it is a separate, forgettable step that only the surfaces written
against a socket remembered. The extraction that would stop a ninth surface from missing it is to make the client
part of opening the entry rather than a follow-up call: either a register(..., connectionId, clientAddress)
overload, or a RunningQueryRegistry.register(..., ClientRef) where ClientRef is what each transport already
holds. With that, "who is this" is answered at the one place an entry is created.

Per surface, meanwhile:

  • MCP: the transport knows the client (HttpServerExchange.getSourceAddress() for the HTTP transport, "stdio" for
    MCPStdioServer). A field on MCPDispatcher set by whichever transport constructed it keeps the dispatcher
    transport-neutral and gives the entry an address.
  • /ws insert: getChannel() is on the session; its peer address is the client.
  • Gremlin: the genuinely hard one, and worth saying so rather than filing it as the same omission. TinkerPop's
    RequestMessage carries no channel, so the address has to be captured where the pipeline does know it - the same
    place setRequestUser is called from - and published on the same ThreadLocal.

Scope / confidence

Refutation attempted:

(a) that the field is decoration because a terminate works by entry id. The terminate does, and that is why this is
low and not medium. But the id is what you use AFTER you have decided which entry to stop, and the decision is what
the listing exists for: the setter's own javadoc calls it "for the listing", and the Postgres half of it is
load-bearing (PostgresBackendFunctions:91 resolves pg_cancel_backend's pid through getConnectionId()).

(b) that sessionId covers the /ws case. It covers one of its four modes. externalTransactionId is non-null
only in transactionMode: "none"; the three server-managed modes that #9838 brought into the listing pass null, and
those are the modes a client gets by not choosing one.

(c) that the user name is enough. It is for the protocols where a user is a person. It is not for MCP, whose whole
deployment shape is one principal shared by every agent connected to the endpoint, nor for a Gremlin Server with a
single configured credential.

(d) that MCP cannot know the client because the dispatcher is transport-neutral. That is the cause, not a reason: the
HTTP transport holds the exchange and the stdio transport knows it is stdio, and both construct the dispatcher.


Activity

  1. added
    mcp
    server
    severity:minor
    on Oct 13, 2026
  2. added
    in progress
    on Oct 13, 2026
  3. self-assigned this
    on Oct 13, 2026
  4. added this to the 26.11.1 milestone on Oct 13, 2026
  5. added 5 commits that reference this issue on Oct 14, 2026
  6. lvca commented on Oct 14, 2026

    @lvca
    Member

    Fixed by #9980 (26.11.1).

    Every entry of list queries (and SHOW TRANSACTIONS) now says which client asked for the work, so with many agents or clients sharing one user you can tell them apart before deciding what to stop:

    • MCP: the client's address over HTTP, stdio for the stdio transport.
    • /ws insert: the session id and the client's address, in every transaction mode.
    • Gremlin Server: the connection id and the client's address.
    • gRPC: the client's address, for regular calls and for the streaming loads, which had the same gap.

    The client is now required when an entry is opened, so a future protocol cannot forget it. A client whose address is unknown simply has no clientAddress field instead of "null".


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  7. removed
    in progress
    on Oct 14, 2026
  8. added a commit that references this issue on Oct 15, 2026
  9. added 5 commits that reference this issue on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggremlinmcpserverseverity:minor

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions