Skip to content

fix(timeout): respect insertion timeout from config for fixed_batch#2048

Open
jpsoultanis wants to merge 1 commit into
weaviate:mainfrom
jpsoultanis:js--insertion-timeout-config-fix
Open

fix(timeout): respect insertion timeout from config for fixed_batch#2048
jpsoultanis wants to merge 1 commit into
weaviate:mainfrom
jpsoultanis:js--insertion-timeout-config-fix

Conversation

@jpsoultanis
Copy link
Copy Markdown

@jpsoultanis jpsoultanis commented May 29, 2026

Summary

There's a bug where the Weaviate Python client SDK doesn't respect the config.Timeout for batch insertions. This issue dates back a while.

_BatchBase.__send_batch passes a hardcoded DEFAULT_REQUEST_TIMEOUT = 180 as the gRPC deadline for BatchObjects [src]:

DEFAULT_REQUEST_TIMEOUT = 180

# ... 

self.__batch_grpc.objects(
    connection=self.__connection,
    objects=[obj._to_internal() for obj in objs],
    timeout=DEFAULT_REQUEST_TIMEOUT,  # <-----------------------
    max_retries=MAX_RETRIES,
)

This silently ignores set values in config additional_config.timeout.insert. Ex:

weaviate.connect_to_custom(
   ...   
   additional_config=weaviate.config.AdditionalConfig(
      timeout=weaviate.config.Timeout(insert=600),  # Values in seconds <-----------------
   ),
)

The change in this PR makes it honor the configured Timeout.insert config value, matching the sibling code paths (batch deletion, insert_many).

Context

Timeout.insert is already honored by other write paths:

  • _DataExecutor.insert_manyweaviate/collections/data/executor.py:216
  • grpc_batch_delete (sync) — weaviate/connect/v4.py:1048
  • grpc_batch_delete (async) — weaviate/connect/v4.py:1230

__send_batch in weaviate/collections/batch/base.py was the odd one out.

Behavior change

This PR as-is comes with an important behavioral change in the default case. The default Timeout.insert is 90s (weaviate/config.py:59). Users on the default configuration will now see a 90s gRPC insertion deadline on BatchObjects instead of the previous 180s. This makes the Timeout.insert field actually reflect the value used at the call site, at the cost of a tighter default.

If 90s turns out to be too tight specifically for batch with server-side vectorizers, this requires further discussion by Weaviate maintainers. We could potentially raise this default to 180s to match the previous default, but this comes with additional tradeoffs to consider.

Copy link
Copy Markdown

@orca-security-eu orca-security-eu Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@jpsoultanis jpsoultanis changed the title fix(timeout): respect insertion timeout from config fix(timeout): respect insertion timeout from config for fixed_batch May 29, 2026
@weaviate-git-bot
Copy link
Copy Markdown

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

@jpsoultanis-kapa
Copy link
Copy Markdown

I agree with the CLA

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants