[erlang-questions] clarify: R12B0 weird gen_fsm behavior (is it a bug?)

Mateusz Berezecki mateuszb@REDACTED
Fri Feb 1 14:29:13 CET 2008

Hello list readers,

I've encountered a weird gen_fsm behavior.

This is an excerpt of a case clause which gets executed.
The commented code is not compiled and not executed so
having {next_state, 'JOINED', State1} goes into next state
correctly. When I uncomment the code the FSM no longer
goes into 'JOINED' state but remains in the current state.
All of the functions in the commented code
execute correctly and do not cause
any abnormal termination of the process.

Having commented out the code I was lucky enough to notice
that the parent field in the #state{} record does not change to the
new content as well !!

What is happening? Am I doing something wrong or
is it a bug?

		accepted ->
%			multicast_root(R, Children, Me),
%			update_siblings(R, Children),
%			ModState1 = Mod:parent_changed(Src, StateData, ModState),
%			ModState2 = case Root =:= R of
%				true -> ModState1;
%				false -> Mod:root_changed({Root, R}, StateData#state{root = R,  
parent = Src,
%				 				siblings = S, mod_state = ModState1}, ModState1)
%			end,

			State1 = StateData#state{root = R, parent = {Src,Socket}, siblings  
= S, mod_state = ModState},
			{next_state, 'JOINED', State1#state{parent = {Src,Socket}}};

best regards,
Mateusz Berezecki

More information about the erlang-questions mailing list