Skip to content

feat(connectors): fix state & memory leak, test all plugins, enrich sinks#2685

Open
spetz wants to merge 5 commits intomasterfrom
connectors_fix
Open

feat(connectors): fix state & memory leak, test all plugins, enrich sinks#2685
spetz wants to merge 5 commits intomasterfrom
connectors_fix

Conversation

@spetz
Copy link
Contributor

@spetz spetz commented Feb 5, 2026

Connectors runtime lost state on restart - sink connectors resumed from offset 0 instead of their last committed position. The root cause was twofold: consumer group offset queries required membership (which new runtime instances lacked), and stale members from closed TCP connections blocked partition assignment to new members.

Consumer group offset resolution now supports direct queries without membership for ConsumerGroup consumers, since offsets are stored per group+partition, not per member. Stale member cleanup during join removes members whose client connections no longer exist, enabling proper partition rebalancing.

Runtime architecture refactored to fix memory leaks - replaced centralized status manager with DashMap-based SinkManager and SourceManager. Explicit channel cleanup on shutdown prevents dangling references.

State management uses MessagePack serialization for efficient binary persistence. PostgreSQL source fixed to actually return state from poll() and moved database I/O outside mutex to eliminate lock contention.

Additional changes:

  • Replaced chrono with IggyTimestamp across SDK and connectors
  • Added shared API types in sdk/src/api.rs for runtime HTTP API
  • Sink connectors track state, enrich with Iggy metadata, retry transient errors with exponential backoff
  • Comprehensive integration tests for all connector plugins

@spetz spetz added the connectors Connectors runtime label Feb 5, 2026
@spetz spetz requested review from hubcio and mmodzelewski February 5, 2026 11:50
@spetz spetz changed the title feat(connectors): fix state & memory leak, test all plugins, enrich s… feat(connectors): fix state & memory leak, test all plugins, enrich sinks Feb 5, 2026
@spetz spetz added test New testcase, or improvement of existing rust Pull requests that update Rust code labels Feb 5, 2026
@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

❌ Patch coverage is 71.29630% with 124 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.35%. Comparing base (4052619) to head (576bf8f).

Files with missing lines Patch % Lines
core/connectors/runtime/src/source.rs 29.31% 33 Missing and 8 partials ⚠️
core/connectors/runtime/src/sink.rs 23.68% 24 Missing and 5 partials ⚠️
core/server/src/shard/system/consumer_groups.rs 32.35% 23 Missing ⚠️
core/connectors/sources/postgres_source/src/lib.rs 93.81% 4 Missing and 2 partials ⚠️
core/server/src/metadata/absorb.rs 66.66% 3 Missing and 1 partial ⚠️
core/common/src/utils/timestamp.rs 50.00% 3 Missing ⚠️
core/connectors/sdk/src/lib.rs 86.95% 2 Missing and 1 partial ⚠️
core/connectors/sdk/src/sink.rs 0.00% 3 Missing ⚠️
core/connectors/sdk/src/transforms/json/mod.rs 50.00% 3 Missing ⚠️
core/connectors/runtime/src/api/models.rs 0.00% 1 Missing and 1 partial ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2685      +/-   ##
==========================================
+ Coverage   69.52%   70.35%   +0.83%     
==========================================
  Files         568      568              
  Lines       55238    55505     +267     
  Branches    55238    55505     +267     
==========================================
+ Hits        38404    39052     +648     
+ Misses      14956    14537     -419     
- Partials     1878     1916      +38     
Flag Coverage Δ
rust 70.35% <71.29%> (+0.83%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
core/connectors/runtime/src/api/mod.rs 50.68% <100.00%> (-1.32%) ⬇️
core/connectors/runtime/src/configs/connectors.rs 28.18% <ø> (ø)
...s/runtime/src/configs/connectors/local_provider.rs 55.24% <ø> (ø)
core/connectors/runtime/src/context.rs 88.09% <ø> (ø)
core/connectors/runtime/src/main.rs 80.59% <100.00%> (+1.73%) ⬆️
core/connectors/runtime/src/manager/sink.rs 63.63% <ø> (+5.45%) ⬆️
core/connectors/runtime/src/manager/source.rs 78.18% <ø> (+20.00%) ⬆️
core/connectors/runtime/src/stats.rs 75.00% <ø> (+22.50%) ⬆️
core/connectors/sdk/src/api.rs 100.00% <100.00%> (ø)
core/connectors/sdk/src/encoders/proto.rs 71.62% <100.00%> (ø)
... and 19 more

... and 18 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

mmodzelewski
mmodzelewski previously approved these changes Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

connectors Connectors runtime rust Pull requests that update Rust code test New testcase, or improvement of existing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants