I'm trying to work out the propagator for the free scalar field theory (i.e., the Green's function for the Klein-Gordon equation). On pages 23 and 24 of Zee's Quantum Field Theory in a Nutshell (you can also find the exact same derivation on page 5 of this) he puts this in the form of an integral over 4-momentum like so:
$$D(x) = \int \frac{d^4 k}{(2\pi)^4} \frac{e^{ikx}}{k^2 - m^2 + i\epsilon}$$
where the $+i\epsilon$ is equivalent to going under the pole in the left half-plane and over the pole in the right half-plane. So far, so good. He then does a contour integral over the energy component of four-momentum to get this:
$$D(x) = -i\int \frac{d^3k}{(2\pi)^3 2\omega_k}[e^{-i(\omega_k x^0-\vec{k}\cdot\vec{x})}\theta(x^0) + e^{i(\omega_k x^0-\vec{k}\cdot\vec{x})}\theta(-x^0)]$$ where $\omega_k = \sqrt{\vec{k}^2+m^2}$ and $\theta$ is the Heaviside step function. Again, I can't find anything wrong with this. But when I try to do the integral over three-momentum, either in Mathematica or by hand, it diverges horribly. I've tried to do this over a range of conditions ($x^0 = 0$ and $\vec{x} \neq 0$, $x^0>0$ and $\vec{x}=0$, etc.) and no matter what I get an integral over $|k|$ that fails to converge. What am I doing wrong here?
As an example: Suppose $x^0 = 0$ and $\vec{x} \neq 0$. Then our integral turns into $$-i\int \frac{d^3k}{(2\pi)^3 2\omega_k} \cos(\vec{k}\cdot\vec{x}).$$ Writing this in a spherical coordinate system gives (since there's no $\phi$-dependence) $$-i\int_0^\infty dr \int_0^\pi d\theta \frac{r^2\sin\theta}{8\pi^2\sqrt{r^2+m^2}}\cos(r|x|\cos\theta).$$ You can do the integral over $\theta$ pretty easily to get $$-\frac{i}{4\pi^2 |x|} \int_0^\infty dr \frac{r\sin(r|x|)}{\sqrt{r^2+m^2}},$$ which diverges. It seems rather bad that a disturbance should have infinite amplitude to propagate somewhere else instantaneously, so obviously something has gone very wrong here.