3.2.1.2.2 RunspacePool State

Each RunspacePool has an associated state. The state of a newly created RunspacePool MUST be initialized to: BeforeOpen.

Section 2.2.3.4 lists available states and describes the data type used to encode the state in PSRP messages.

Sections 3.2.5.4.1 and 3.2.5.4.2 describe how RunspacePool state transitions from the BeforeOpen state to the NegotiationSucceeded state, and then to the Opened state. From the Opened state, a RunspacePool can reach either the Closed or Broken state, mentioned in section 2.2.3.4.

A client can close a RunspacePool by sending wxf:Delete message (section 3.1.5.3.11). When a server receives this message, the server MUST stop all the running pipeline, change the RunspacePool state to Closed, and send a wxf:DeleteResponse message (section 3.2.5.3.1).

The server can change the RunspacePool state from Opened to Broken at any time if the server determines that something is wrong with the RunspacePool (such as a network connection getting lost or a corrupted RunspacePool). Before changing the state to Broken, the server MUST stop all the running pipelines. After changing the RunspacePool state to Broken, the server MUST send a RUNSPACEPOOL_STATE message (section 3.2.5.4.9) with a Broken state to the client if there is a pending wxf:Receive message (see section 3.2.5.3.7).

Server RunspacePool states and transitions

Figure 4: Server RunspacePool states and transitions