What does broken promise error mean?

ACTOR template <class T>
Future<T> brokenPromiseToNever(Future<T> in) {
	try {
		T t = wait(in);
		return t;
	} catch (Error& e) {
		if (e.code() != error_code_broken_promise)
			throw;
		wait(Never()); // never return
		throw internal_error(); // does not happen
	}
}

what’s the meaning of this error message error_code_broken_promise, and why fdb is using this actor? to ignore some servers shutting down?

error_code_broken_promise is an error code to indicate that an PRC server side no longer exists, thus the client side gets this error.

This brokenPromiseToNever is used to ignore such errors. This is intended, because most of the time such errors are caused by crashing server, which results in a transaction system recovery. Thus, the client side typically don’t need to perform error handling due to such errors----the client just blocks at wait(Never()) and is restarted during the recovery.

1 Like