Cannot get interupts to work consistently

Can you provide a schematic and links to those components please ?
"relay" covers a wide range of components!

The code is so siomple it would appear to be a hardware issue.