TITLE: Functions that are Riemann integrable but not Lebesgue integrable
QUESTION [50 upvotes]: I know there are functions which are Riemann integrable but not Lebesgue integrable, for instance, $$\int_{\mathbb{R}} \frac{\sin(x)}{x} \mathrm{d}x$$
Is Riemann integrable and it is easily shown that its value is $\pi
$, nevertheless, it is not Lebesgue integrable because
$$\int_{\mathbb{R}} \left|\frac{\sin(x)}{x}\right| \mathrm{d}x$$
diverges.
What is going on here? I thought Lebesgue integration was supposed to be an extension of Riemann integration, kind of like principal values are an "extension" of the notion of improper integral, and if an improper integral converges, it is equal to its principal value, why then every function that is Riemann integrable is not Lebesgue integrable?
Of course the opposite is also true, there are functions which are Lebesgue integrable but not Riemann integrable, so what is going on here? How does one integral notion extend the other and how do they not contradict themselves?
Thank you.

REPLY [6 votes]: For $r>0$, your function has both a Riemann and a Lebesgue integral over $[0,r]$, and they have the same value in terms of $r$. Now let $r\to\infty$. This common $r$-dependent value tends to a limit, which is traditionally called the improper Riemann integral over $[0,\infty)$. It might just as well be called the improper Lebesgue integral over $[0,\infty)$, but for (good) historical reasons it is not. As others have commented, such terminology is misleading: the value is a limit of a (parameter-dependent) integral and not itself an integral. That said, there is seldom any problem in treating such limits as integrals; so the terminology usually doesn't give rise to confusion in practice.