ABSTRACT We consider the relativistic hydrodynamics of non-perfect fluids with the goal of determining a formulation that is suited for numerical integration in special-relativistic and general-relativistic scenarios. To this end, we review the various formulations of relativistic second-order dissipative hydrodynamics proposed so far and present in detail a particular formulation that is fully general, causal, and can be cast into a 3+1 flux-conservative form, as the one employed in modern numerical-relativity codes. As an example, we employ a variant of this formulation restricted to a relaxation-type equation for the bulk viscosity in the general-relativistic magnetohydrodynamics code bhac. After adopting the formulation for a series of standard and non-standard tests in 1+1-dimensional special-relativistic hydrodynamics, we consider a novel general-relativistic scenario, namely, the stationary, spherically symmetric, viscous accretion on to a black hole. The newly developed solution – which can exhibit even considerable deviations from the inviscid counterpart – can be used as a testbed for numerical codes simulating non-perfect fluids on curved backgrounds.