Robustness of IC and erl_interface

Steve Langstaff srl@REDACTED
Tue Apr 10 12:12:39 CEST 2001


Hi all. Question for all you IC/erl_interface gurus out there:

For a call from a C-node to an Erlang genserver (names changed to protect 
the guilty!):

module mod {
	interface intf {
		void call(
			in unsigned long param1,
			in unsigned long param2,
			in unsigned long param3,
			in unsigned long param4,
			in unsigned long param5,
			in unsigned long param6,
			in unsigned long param7
		);
	}
}

IC generates something like the following code:

void mod_intf_call(mod_intf oe_obj, CORBA_unsigned_long param1, 
CORBA_unsigned_long param2, CORBA_unsigned_long param3, CORBA_unsigned_long 
param4, CORBA_unsigned_long param5, CORBA_unsigned_long param6, 
CORBA_unsigned_long param7, CORBA_Environment *oe_env) {

  int oe_msgType = 0;
  erlang_msg oe_msg;

  /* Initiating the message reference */
  ic_init_ref(oe_env,&oe_env->_unique);

  /* Initiating exception indicator */
  oe_env->_major = CORBA_NO_EXCEPTION;

  /* Creating call message */
  if (mod_intf_call__client_enc(oe_obj, param1, param2, param3, param4, 
param5, param6, param7, oe_env) < 0) {
    if (oe_env->_major == CORBA_NO_EXCEPTION)
      CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, MARSHAL, "Cannot encode 
message");
  }

  /* Sending call request */
  if (oe_env->_major == CORBA_NO_EXCEPTION) {
    if (strlen(oe_env->_regname) == 0) {
      if (ei_send_encoded(oe_env->_fd, oe_env->_to_pid, oe_env->_outbuf, 
oe_env->_iout) < 0) {
        CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, NO_RESPONSE, "Cannot 
connect to server");
      }
    }
    else if (ei_send_reg_encoded(oe_env->_fd, oe_env->_from_pid, 
oe_env->_regname, oe_env->_outbuf, oe_env->_iout) < 0) {
      CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, NO_RESPONSE, "Cannot 
connect to server");
    }
  }

  /* Receiving reply message */
  if (oe_env->_major == CORBA_NO_EXCEPTION)
    do {
      if ((oe_msgType = ei_receive_encoded(oe_env->_fd, &oe_env->_inbuf, 
&oe_env->_inbufsz, &oe_msg, &oe_env->_iin)) < 0) {
        CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, MARSHAL, "Cannot 
decode message");
        break;
      }
    } while (oe_msgType != ERL_SEND && oe_msgType != ERL_REG_SEND);

  /* Extracting message header */
  if (oe_env->_major == CORBA_NO_EXCEPTION)
    if (mod_intf__receive_info(oe_obj, oe_env) < 0) {
      CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, MARSHAL, "Bad 
message");
  }

  /* Extracting message tail */
  if (oe_env->_major == CORBA_NO_EXCEPTION)
    if (mod_intf_call__client_dec(oe_obj, oe_env) < 0) {
      CORBA_exc_set(oe_env, CORBA_SYSTEM_EXCEPTION, MARSHAL, "Bad message 
tail");
    }
}

This works OK for the simple case, but what happens if my genserver exits 
before sending a response
(or the node that it's on fails, or...)?

Will my C-node be hung waiting for a response until TCP/IP times out (maybe 
a couple of hours)?

Any ideas on how I could make this more responsive to failure, maybe with a 
client-side timeout
specified somehow?

--
Steve L.




More information about the erlang-questions mailing list