I'm working on a battery powered prototype and have discovered an annoying bug. When power is removed from the device by disconnecting the battery, the voltage on the 5V power rail will decay fairly quickly to around 2V but then will decay much slower. In fact, it will stay between 2V and 1V for around 30 seconds. If the device is restarted during that time (i.e. the battery is reconnected), one of the chips will go into a bad state and the device will malfunction. This is especially annoying because this is precisely how most people power-cycle the device.
I figure that there is still residual charge being stored in the decoupling capacitors on the 5V power rail, which is causing the device to sit in this range for a while until parasitic resistances slowly drain the capacitors. Could this be correct?
If so, is there a generally accepted way to best discharge those decoupling capacitors?