Skip to content

fix: lease state machine entities for as long as a batch may take to process - #1146

Merged
paullatzelsperger merged 1 commit into
eclipse-edc:mainfrom
paullatzelsperger:fix/1145_lease_duration_and_send_timeouts
Oct 13, 2026
Merged

paullatzelsperger merged 1 commit into
eclipse-edc:mainfrom
paullatzelsperger:fix/1145_lease_duration_and_send_timeouts

Conversation

@paullatzelsperger

Copy link
Copy Markdown
Member

What this PR changes/adds

  • The lease duration of both state machines, issuance processes (edc.issuer.issuance.*) and credential requests
    (edc.iam.credential.request.*), can be configured with state-machine.lease-duration-millis, and defaults to
    5 minutes. The SQL stores of the issuance processes and of the credential requests lease their entities for that
    long.
  • The messages that a state machine sends under the lease, i.e. delivering credentials and rejections, and sending
    credential requests, are sent with an HTTP client that does not retry them, as the state machine retries the
    operation anyway, and that gives up after configurable timeouts: send.connect-timeout.ms (5 s) and
    send.call-timeout.ms (15 s). The status polling of credential requests uses that client as well.
  • The default batch size of both state machines is 10 instead of 20, so that a batch fits into the lease. A warning is
    logged at startup if the batch size times the call timeout is not less than the lease duration.
  • Documents the settings.

Why it does that

A state machine leases a batch of entities at once, and processes them one by one. The lease lasted 60 seconds, but a
single counterparty that did not respond could hold up a batch for more than 3 minutes: the messages were sent with
connect and read timeouts of 30 seconds each, and retried up to 5 times by the HTTP client. Another runtime could then
lease and process the same entities in the meantime, e.g. issue and deliver the credentials of an issuance process
twice, or send a credential request again.

Checking before each entity of a batch that the lease is still held is left to a separate PR.

This depends on eclipse-edc/Connector#6088, which adds forTime(Duration) to the SqlLeaseContextBuilder SPI. It
does not compile until a Connector snapshot with it is published.

Linked Issue(s)

Closes #1145

🤖 Generated with Claude Code

@paullatzelsperger
paullatzelsperger requested a review from a team as a code owner October 12, 2026 12:33
@paullatzelsperger paullatzelsperger added the bug Something isn't working label Oct 12, 2026
…process

The state machines of the issuance processes and of the credential requests
leased a batch of 20 entities for 60 seconds, but a single counterparty that did
not respond could hold up a batch for more than 3 minutes: the messages were sent
with timeouts of 30 seconds, and retried up to 5 times by the HTTP client. Another
runtime could then lease and process the same entities in the meantime.

- The lease duration can be configured for each state machine
  (state-machine.lease-duration-millis), and defaults to 5 minutes.
- The messages that are sent under the lease, i.e. delivering credentials and
  rejections, and sending credential requests, are sent without retries of the
  HTTP client, as the state machine retries them anyway, and with configurable
  connect and call timeouts (send.connect-timeout.ms, send.call-timeout.ms),
  5 and 15 seconds by default.
- The default batch size is 10, so that a batch fits into the lease, and a
  warning is logged if it may not.

Requires eclipse-edc/Connector#6088.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@paullatzelsperger
paullatzelsperger force-pushed the fix/1145_lease_duration_and_send_timeouts branch from 35a5d26 to 1e31665 Compare October 12, 2026 12:35
@paullatzelsperger
paullatzelsperger merged commit 763621d into eclipse-edc:main Oct 13, 2026
27 of 29 checks passed
@paullatzelsperger
paullatzelsperger deleted the fix/1145_lease_duration_and_send_timeouts branch October 13, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

State machines lease their entities for less time than they process them

2 participants