Skip to content

Engine limiters and checking task cancellation #262

Open
@milseman

Description

@milseman

During proposal reviews, concerns of RDoS and responsivity came up. We should add engine limiters which can halt execution if some threshold is exceeded, either counted in time or number of byte code instructions (possibly proportional to input length). Additionally, we should check Task.checkCancellation() in case the parent task has been cancelled.

  • Basic limiter infrastructure based on engine cycle count
  • Occasionally (say every thousand bytecode instructions executed) check cancellation
  • Testing infrastructure around limiters
  • Limiters based on input length
  • Surface as API

From https://forums.swift.org/t/se-0350-regex-type-and-overview/56530/19:

In the meantime, before that is available, would it be possible to include some calls to Task.checkCancellation() during the evaluation of the match? The use case I'm thinking of for this for evaluating a user-specified Regex in an interactive application. If the match operation is taking too long, it should be possible for the user to cancel this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions