Skip to content

[BUG] QdrantEmbeddingStore loses the interrupt status when a call is interrupted #6481

Description

@xinqi123321

Describe the bug

QdrantEmbeddingStore.addAll() waits for client.upsertAsync(...).get(), and when that call is
interrupted it rethrows the InterruptedException wrapped in a RuntimeException without putting
the thread's interrupt status back. The caller gets the exception, but
Thread.currentThread().isInterrupted() is false.

The same thing happens in removeAll(Collection), removeAll(Filter), search() and
clearStore(). Five call sites, none of them restores the flag.

Other embedding stores in this repo already get it right. MongoDbEmbeddingStore calls
Thread.currentThread().interrupt() before rethrowing, and MilvusV2EmbeddingStore does the same
around its useDatabase call. The same fix has gone in for DockerMcpTransport (#6411),
DefaultMcpClient (#6362) and RetryUtils (#4480), so I think this is a spot that simply got
missed.

Log and Stack trace

Nothing gets logged. The interrupt status is silently cleared.

To Reproduce

Call addAll() against a Qdrant instance, interrupt the calling thread while the upsert is in
flight, then check Thread.currentThread().isInterrupted() in the catch block. It's false.

You don't need a running Qdrant for this either. With a mock client whose future never completes,
the interrupt makes get() fail with InterruptedException, which clears the flag, and nothing
sets it back. A test doing exactly that fails on main today.

Expected behavior

The interrupt status is restored before the RuntimeException is thrown.

Please complete the following information:

  • LangChain4j version: 1.21.0-SNAPSHOT (main)
  • LLM(s) used: not applicable
  • Java version: 21
  • Spring Boot version (if applicable): not applicable

Additional context

All five call sites are in langchain4j-qdrant.

WorkersAiEmbeddingModel in langchain4j-workers-ai has the same pattern in two places, and one
of them swallows the exception completely. Happy to do that one separately if you want it.

I'd like to take this one.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions