He is "the God of all comfort" - and we will need Him to be (II Corinthians 1:3).
Try as we might in modern times to reduce or even eliminate pain, suffering, loss, heartache, and heartbreak, the truth is that we cannot avoid the realities of a cursed and fallen world. God promised sorrow to Adam and Eve because of their sin, and thus assured humanity of its need for a comfort that only our Lord can provide (Genesis 3:16-17).
This is a hard, but blessed truth. The pleasures of God's blessing are wonderful gifts, and we see much of His person and truth in them. In our present existence, however, it seems that the sorrows of life allow and motivate us to most know the very heart of God if we will trust and submit unto Him when we hurt. We may not even realize that such illumination is happening as we seemingly hang on by a thin thread of faith during our trials. Down the road a bit, however, we often look back and know the Lord Jesus Christ had drawn very near to us as "a very present help in trouble" (Psalm 46:1). His light was shining, His hand was keeping, and His heart was comforting. Most importantly, He was revealing to us who He is. Thus, the trusting child of God comes forth from the valley having known a comfort that is far more than the mere assuaging of pain. It is rather the comfort of having grown in the living, true, and personal knowledge for which we exist. "This is life eternal, that they might know Thee the only true God, and Jesus Christ whom Thou hast sent" (John 17:3).
As the old saying goes, "Trouble's always a'comin." Regardless of how securely we may seem to have battened down the hatches, as it were, sorrow finds it way to us. God Himself has determined this in the greatness of His love, which "passeth knowledge" (Ephesians 3:19). There are wonders of such love that we would never know in this present life if pain did not press us to seek and partake of His peace. The God of all comfort meets us in the very midst of our sorrows, revealing not only His comfort, but even more, Himself.
"The God of all grace, who hath called us unto His eternal glory by Christ Jesus, after that ye have suffered a while, make you perfect, stablish, strengthen, settle you." (I Peter 1:5)