[Pvfs2-developers] state machine ending
Phil Carns
pcarns at wastedcycles.org
Wed Jul 26 11:40:46 EDT 2006
Sam Lang wrote:
>
> On Jul 24, 2006, at 2:07 PM, Pete Wyckoff wrote:
>
>> walt at clemson.edu wrote on Mon, 24 Jul 2006 14:47 -0400:
>>
>>> 3) the state machine language has a keyword that lets you state that
>>> the
>>> next state is "terminate" which could be used to finish the state
>>> machine, but right now the code has logic that detects this and
>>> prints a
>>> warning that you should NOT use this. I don't know why we created this
>>> method and then made it illegal. Go figure!
>>
>>
>> I prefer #3 by a large margin over the other options. It's
>> explicit, not racy, doesn't over-use the return value for a
>> conceptually different event, and doesn't rely on modifying
>> parent state. Wonder why it was disabled.
>>
> I think terminate ended up being more of a placeholder...we still use
> it in quite a few of our state machines, but the last state action is
> expected to call server_state_machine_complete which prevents the SM
> from transitioning to the 'terminate' state. I've thought of it as an
> assert: if you get here you're forgetting something.
Just for historical reference, the terminate state was never really used
in pvfs2- it wasn't that it was disabled or illegal. It was just that
the completion functions destroyed the sm before it got to that point.
I think I added the safety check later on because we had a few "runaway
state machine" bugs where sms weren't calling their completion functions
on the way out. The terminate transition ended up being a good place to
catch that sort of problem since the pvfs2 state machines that worked
properly were never supposed to hit it.
I think nowadays a better way to track down that sort of problem would
be with a state machine dumper utility (like the one Derek Horton
started but we never got around to polishing up) because something like
that could point out runaway state machines even if they get lost
somewhere before termination. I don't know if you have any interest in
something like that, Walt, but you might want to have a look at what
those patches did to see if there is a cleaner way to implement
something along those lines with your new infrastructure changes.
Anyway, I agree with all of the comments from Walt, Sam, and Pete- it
sounds like this stuff will be a lot cleaner.
-Phil
More information about the Pvfs2-developers
mailing list