Green's function for the Klein-Gordon equation diverging? 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.
 A: You have found the reason that most 4D QFTs need to have renormalization: The propagator is (UV) divergent!
To "cure" the theory, you need to regularize the theory (make the divergences expressible in some simple parameter like a momentum cutoff) - e.g. by dimensional regularization - and then proceed with some renormalization scheme. That the theory is non-interacting means that there are only finitely many divergent things - the propagator itself - as opposed to the infinitely many divergent diagrams what would need to be organized in orders of perturbation theory in an interacting theory, but, as you see, it does not preclude the necessity of renormalization as such.
A: According to these lecture notes (page 18 in the pdf) and a few others I have found, the integral can in fact be evaluated and yields the modified Bessel function of the second kind, of order 1 (see Wikipedia).
The integral does not seem converge, but I am not sure if you can say that it diverges, because it oscillates (with increasing amplitude). The way physicists "solve" these integrals is by going to the complex plane, where they converge and then taking the limit as the integral approaches the real line. The fishy bit is that the integral does not commute with the limit, but the justification for doing it is that it works.
Another way would be noting
$$ K_0(xm)=\int_0^\infty\frac{dr\,\cos(xr)}{\sqrt{m^2+r^2}} $$
That's another Bessel function (I hope we can agree it converges). Then
$$ mK_1(xm)=-m\partial_xK_0(xm)=-\int_0^\infty \frac{dr\,r\,\sin(xr)}{\sqrt{m^2+r^2}}. $$
The first equality is a definition (I think), the second is a bit fishy, as promised (maybe a Mathematician can comment?).
For large $x$, this decays as $e^{-mx}$ (see the lecture notes I referenced), which is somewhat reassuring. But (again paraphrasing Tong's notes), the worrying bit is that it is at all non-zero, because, as you said, the interval is spacelike ("instantaneously" is reference frame dependent, and therefore not a physical property -- neither should be allowed though). 
The resolution of the conundrum is that the actual, physical requirement is that operators evaluated at points separated by spacelike points must commute, such that measurements at the two points cannot depend upon each other. But luckily, even from your expression above, it can be seen that, because $r$ is just the magnitude of the spacelike separation, the commutator is always zero (try it explicitly if you like). 
