By John Spence Buckle up, it could be a bumpy ride. The government shutdown this week is giving stock investors a taste of what could be a volatile October, with the debt ceiling lurking on the horizon and creating additional uncertainty. The S&P 500 has delivered a total return of around 20% this year, but investors are worried the market is overextended as a notoriously volatile month for stocks gets underway. Some of the worst stock-market crashes have struck in October, according to the Stock Trader's Almanac.The looming debt ceiling battle is another investor concern amid the gridlock in Washington and still-delicate economic recovery. The Dow lost nearly 130 points on Monday but recouped some of that loss on Tuesday after the first U.S. government shutdown in almost two decades put more than 800,000 workers on furlough.aThe last U.S. government closure was in 1995/96, when non-essential services were halted for nearly 30 days. However, government shutdowns that have occurred over the past 40 years have tended not to derail the stock market over the long haul. During this period, the S&P 500 has posted better-than-average returns in the year following a government shutdown, according to Bloomberg. This doesn't mean the current budget impasse is necessarily a buying opportunity. But investors should be careful of letting negative news shocks like the government shutdown and debt-ceiling battle divert their long-term plans. The last government shutdowns hit in November and December 1995, and January 1996. Interestingly, the S&P 500 rose in all three of those months, according to data from S&P Dow Jones Indices. The index gained more than 4% in November 1995 and over 3% in January 1996. The S&P 500 went on to post a total return of 23% in 1996 as the shutdown ended up being little more than a speed bump during the late 1990s rally. Of course, it remains to be seen how much damage the U.S. economy will suffer as a result of the current government halt. The last shutdowns in 1995 and 1996 cost the government an estimated $1.4 billion, according to the OMB. There are also questions about whether the debt ceiling will be raised by the mid-October deadline, a crisis that could trigger a U.S. debt default.