microsoft / durabletask-mssql

Microsoft SQL storage provider for Durable Functions and the Durable Task Framework
MIT License
87 stars 32 forks source link

Payload leak in ContinueAsNew #100

Closed cgillum closed 2 years ago

cgillum commented 2 years ago

ContinueAsNew is able to reclaim rows in the History table, ensuring that an eternal orchestration doesn't create an infinite history. However, the SQL storage logic doesn't correctly clean up the dt.Payloads table when doing ContinueAsNew.

Here's a screenshot showing the results of the Orchestrations.ContinueAsNew integration test. As can be seen, there is a row in the dt.Payloads table for every input.

image

The expected behavior is that there is a row only for the currently valid inputs that have corresponding references in the dt.History table. Otherwise, ContinueAsNew effectively results in an unlimited number of orphaned dt.Payloads rows.