Repository navigation
Fix/ingest df pool timeout - #385
Open
omirandadev wants to merge 4 commits into
Open
omirandadev wants to merge 4 commits into
omirandadev wants to merge 4 commits into
Conversation
…rker count PassthroughProvider.ingest_df forks SPARK_DRIVER_CORES - 1 worker processes per call and waited on Pool.starmap() with no timeout, so a worker that never returns hung the caller forever with no error. In Spark streaming that is a silent zombie: the foreachBatch never returns, the stream stops making progress, and nothing is logged. - Wait on the pool with starmap_async(...).get(timeout); on expiry terminate the pool and raise IngestWorkerHungError. Default 600s, overridable via FEAST_INGEST_POOL_TIMEOUT_SECONDS (<= 0 disables). - Add FEAST_INGEST_WORKERS to set the worker count explicitly; 1 or 0 writes in-process with no fork. Unset keeps the legacy SPARK_DRIVER_CORES sizing. NUM_PROCESSES is still exported on every path for the Redis/Valkey stores. - Name the new error so spark_kafka_processor._is_transient_error does not retry it; worker exceptions propagate unchanged.
The insert templates formatted the TTL into the statement text. Sorted feature views compute the TTL per row (feature view TTL minus event age), so nearly every row produced a new statement string. _get_cql_statement caches prepared statements by text, so each one was a synchronous session.prepare() round trip, a new entry in an unbounded client cache, and a new prepared statement stored by Cassandra. On a busy cluster this showed up as many stored statements that differ only in the TTL literal (e.g. "USING TTL 7775991"), alongside heap and GC pressure. - Use a bind marker (USING TTL ?) in both insert templates and bind the TTL as the last value. Bound 0 means no TTL, as the literal did. - Prepare the sorted-view insert once per write call instead of per row. On Cassandra 4.1.4, writing 300 sorted rows with distinct event ages added 600 rows to system.prepared_statements before this change and 2 after. The stored TTLs are unchanged.
online_write_batch raises only the first write failure. Log every failed write from the driver callback, with the table name and traceback, as the previous callback did, so later failures are not lost.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Streaming ingestion to Cassandra could stall with no error:
foreachBatchnever returned. Two waits had no bound.
ingest_dfforkedSPARK_DRIVER_CORES - 1workers (when cores > 2) and waited onPool.starmap()without a timeout, and the Cassandra store waited on writecallbacks without a deadline. Separately, sorted feature views wrote the
per-row TTL into the insert text, so almost every row prepared a new
statement.
This change:
FEAST_INGEST_WORKERS> 1uses spawned workers bounded by
FEAST_INGEST_POOL_TIMEOUT_SECONDS(default 600); on expiry the batch fails with
IngestWorkerHungError.online_write_batchcall a total deadline,write_timeout_seconds(default 120), after which it raisesCassandraWriteTimeoutError. Writes already submitted may still land.load_balancingis set andrequest_timeoutis not (it was disabled), and appliesrequest_timeoutwithout
load_balancingtoo.USING TTL ?) so the sorted-view insert is prepared once.On Cassandra 4.1.4, 300 sorted rows with distinct event ages added 600
prepared statements before and 2 after.
reused from another process.
the query fails instead of retrying inside the batch.
Behavior changes:
ingest_dfno longer forks based onSPARK_DRIVER_CORES. Jobs that relied on that parallelism should setFEAST_INGEST_WORKERS; spawned workers need an import-safe entry script.a healthy call can take longer.
request_timeoutandwrite_timeout_secondsmust be finite and positive.Supersedes #379, which raises its write deadline to at least
request_timeout; here the deadline is a separate setting.Testing: new unit tests for the ingest workers, the provider, Cassandra
write deadlines and logging, TTL binding, and the Spark processor.
🤖 Generated with Claude Code