I'm working on a test program on an ATmega164A that toggles a 12V relay on and off (with no load) through a ULN2003A. For my test program, I'm toggling the relay at 100ms. I've got an IN4001 diode across the coil. Additionally, I've got an LCD that displays a milliseconds counter, which increments in an interrupt. In normal operation, it goes on forever without any issues. I noticed that one of my relay sockets was wonky, so sometimes I need to fiddle with the relay in the socket to get it working again. When I did this, I noticed that sometimes the main loop would hang and I'd get some garbage on the LCD. If I fiddled with the relay some more (and specifically the coil contacts in the socket), the main loop would resume, but the counter value would be correct, indicating that the main loop would be paused but the interrupts would continue.
I mostly fixed the garbage on the LCD by putting a 0.1uF cap right at the power pins, but the main loop will still hang if I do what I mentioned above. I know this is kind of a weird situation and it should never really happen, but I'm just trying to understand it. I just figure that if the main loop gets interrupted somehow, then surely the interrupts wouldn't still be working correctly.