We know for morphisms of schemes $f:X \rightarrow S, u:S’ \rightarrow S, X’=X \times\_S S’$, (coherent) sheaf $F$ over X,we have natural morphism
$$u^\* R^q f\_\*F\rightarrow R^q u’\_\* f’^\*F$$
where $f’, u’$ are basechanges. (Or using derived category if you like.)
The base change theorems says under certain restrictions of the objects and morphisms, it’s isomorphism. Now I’m wondering in more general cases, if there’re some ‘obstruction’ (like certain cohomology groups, spectral sequences) to measure how far it is from isomorphism?



What‘s the obstruction to base change
The composition of functors $Rf\_\* \colon D(X) \to D(S)$ and $Lu^\* \colon D(S) \to D(S')$ is a Fourier--Mukai functor given by an explicit object $K \in D(X \times S')$. It is easy to check that it has no cohomology sheaves in positive degrees, its zero cohomology sheaf is isomorphic to the structure sheaf of the fiber product, but is also may have some cohomology sheaves in negative degrees. The morphism of functors in base change is induced by the natural morphism
$$
K \to \mathcal{H}^0(K).
$$
Consequently, the cone of the morphism in base change is controlled by the Fourier-Mukai functor with kernel $\tau\_{\le -1}(K)$. In particular, base change gives an isomorphism if and only $\tau\_{\le -1}(K) = 0$ if and only if $K = \mathcal{H}^0(K)$.


By the way, the negative cohomology sheaves of $K$ are responsible for the derived structure of the fiber product. So, this answer is essentially equivalent to the comment of @dhy.


