os_mon & alarm_handler in R10B-10

Serge Aleynikov serge@REDACTED
Fri Mar 24 23:06:59 CET 2006


Hi,

I've been experimenting with the reworked os_mon in R10B-10, and 
encountered the following issue.

The documentation encourages to replace the default alarm handler with 
something more sophisticated.  For that reason I created a custom 
handler - lama_alarm_h (LAMA app in jungerl), which uses 
gen_event:swap_sup_handler/3.

I initiate that handler prior to starting OS_MON, and then start OS_MON.

In the latest release R10B-10, OS_MON calls alarm_handler:get_alarms/0 
upon startup.

This causes the 'alarm_handler' event manager issue a call in the 
alarm_handler.erl module.  However, since that handler was replaced by a 
custom alarm handler, the gen_event's call fails with
{error, bad_module}.

gen_event always dispatches a call/3 to a specific handler module passed 
as a parameter, e.g.:

-----[alarm_handler.erl (line: 60)]-----
get_alarms() ->
     gen_event:call(alarm_handler, alarm_handler, get_alarms).
----------------------------------------

Yet, if the alarm_handler handler was swapped by another module, the 
gen_event:call will report an error, therefore crashing OS_MON.

One way to resolve this problem would be to introduce another exported 
function in gen_event:

gen_event:call(EventMgrRef, Request) -> Result

Can the OTP team suggest some other workaround?

Serge

-- 
Serge Aleynikov
R&D Telecom, IDT Corp.
Tel: (973) 438-3436
Fax: (973) 438-1464
serge@REDACTED



More information about the erlang-questions mailing list