GPO and GPIO spikes in output mode


I subscribed some GPOs and GPIOs as output. In a periodic timer function I toggle them. When these pins are HIGH I see some spikes on leds (LEDs go LOW for very short time , where they should stay HIGH).

No problem for leds but what happens if I control some critical systems using these pins?

What can I do? I am sure of correctness of my code.

Note: LED are connectted between pins and ground with appropriate resistors.