The vulnerability CVE-2026-107727 in Strawberry's legacy graphql-ws subscription handler is a resource exhaustion issue. It arises because the system fails to properly deallocate resources (specifically, entries in self.tasks and self.subscriptions dictionaries) associated with one-shot GraphQL subscriptions that have naturally completed. When max_subscriptions_per_connection is configured, the len(self.tasks) count is used to enforce this limit. In the vulnerable version, the GraphQLWSHandler.handle_async_results function, responsible for processing subscription results and sending completion messages, did not include logic to remove the completed operation's bookkeeping entries. This meant that even after a subscription finished and sent a 'complete' message, its task entry remained in self.tasks. Consequently, a client could initiate multiple distinct one-shot subscriptions, each consuming a slot, and even after they completed, these slots would remain occupied. This led to a scenario where subsequent legitimate subscriptions on the same connection would be rejected with a 'Subscription limit reached' error, despite no active subscriptions being present. The patch addresses this by adding a finally block to GraphQLWSHandler.handle_async_results to ensure self.subscriptions.pop(operation_id, None) and self.tasks.pop(operation_id, None) are called, explicitly releasing the resources. Additionally, the GraphQLWSHandler.cleanup_operation function was refactored to use pop more effectively, making the cleanup process more robust and idempotent, further contributing to correct resource management. These changes ensure that completed or failed operations no longer count towards the connection's subscription limit, resolving the availability issue.