  We consider a surface code suffering decoherence due to coupling to a bath of
bosonic modes at finite temperature and study the time available before the
unavoidable breakdown of error correction occurs as a function of coupling and
bath parameters. We derive an exact expression for the error rate on each
individual qubit of the code, taking spatial and temporal correlations between
the errors into account. We investigate numerically how different kinds of
spatial correlations between errors in the surface code affect its threshold
error rate. This allows us to derive the maximal duration of each quantum error
correction period by studying when the single-qubit error rate reaches the
corresponding threshold. At the time when error correction breaks down, the
error rate in the code can be dominated by the direct coupling of each qubit to
the bath, by mediated subluminal interactions, or by mediated superluminal
interactions. For a 2D Ohmic bath, the time available per quantum error
correction period vanishes in the thermodynamic limit of a large code size $L$
due to induced superluminal interactions, though it does so only like
$1/\sqrt{\log L}$. For all other bath types considered, this time remains
finite as $L\rightarrow\infty$.
