Logic Pro 9 lost MIDI connectivity


I'll be happily playing MIDI regions in on cycles, and when happy move to the next few bars and play in some more and so on.

However, every so often, although I have the correct track/instrument selected, playing my controller keyboard gets me silence and I have to stop my workflow to troubleshoot.

The problem is solved as soon as I click on another track of the same instrument.

Why does this disconnect happen and how can I prevent it happening?