CARACAS, Venezuela — The bottlenecks at a major port were so bad this year that Christmas trees from Canada were delayed for weeks, and when they did show up they cost hundreds of dollars. A government-run ice cream factory opened with great fanfare, only to shut down a day later because of a shortage of basic ingredients. Foreign currency is so hard to come by that automakers cannot get parts and new cars are almost impossible to buy.

And all of this happened while the economy was growing — before the slowdown many predict next year.

Such frustrations are typical in Venezuela, for rich and poor alike, and yet President Hugo Chávez has managed to stay in office for nearly 14 years, winning over a significant majority of the public with his outsize personality, his free-spending of state resources and his ability to convince Venezuelans that the Socialist revolution he envisions will make their lives better.

Now that revolution is threatened by Mr. Chávez’s fight with cancer. His health has become precarious enough that before undergoing surgery this week he designated a successor for the first time, saying that Vice President Nicolás Maduro should lead in his place if he cannot continue.