Resetting an engine

A client can send a signal to an engine by using the control channel at any time. However, I/O operations are usually buffered, which may cause troubles. To reset an engine safely the following are required.

  1. Any OX message must be a synchronized object in the sense of Java.

    As an OX message is sent as a combination of several CMO data, a global exit without sending all may generate broken data.

  2. After restarting an engine, a request from a client must correctly corresponds to the response from the engine.

    An incorrect correspondence occurs if some data remain on the stream after restarting an engine.

SM_control_reset_connection is a stack machine command to initiate a safe resetting of an engine. The control server sends SIGUSR1 to the engine if it receives SM_control_reset_connection from the client. Under the OpenXM reset protocol, an engine and a client act as follows.

Client side

  1. After sending SM_control_reset_connection to the control server, the client enters the resetting state. It discards all OX messages from the engine until it receives OX_SYNC_BALL.
  2. After receiving OX_SYNC_BALL the client sends OX_SYNC_BALL to the engine and returns to the usual state.

Engine side

  1. After receiving SIGUSR1 from the control server, the engine enters the resetting state. The engine sends OX_SYNC_BALL to the client. The operation does not block because the client is now in the resetting state.
  2. The engine discards all OX messages from the engine until it receives OX_SYNC_BALL. After receiving OX_SYNC_BALL the engine returns to the usual state.

Figure 1: OpenXM reset procedure
\begin{figure}
\epsfxsize =8.5cm
\epsffile{reset.eps}\end{figure}

Figure 1 illustrates the flow of data. OX_SYNC_BALL is used to mark the end of data remaining in the I/O streams. After reading it, it is assured that each stream is empty and that the subsequent request from a client correctly corresponds to the response from the engine. We note that we don't have to associate OX_SYNC_BALL with any special action to be executed by the engine because it is assured that the engine is in the resetting state when it has received OX_SYNC_BALL.

Nobuki Takayama 2017-03-30