I have a Teensy 3.6 plugged into a custom PCB. One of the functions of the Teensy is to drive a relay to control a solenoid valve. The solenoid is powered from a 24V supply with an isolated ground (24V ground is separate from the Teensy ground), and the relay is a solid-state optoelectronic relay. There's a TVS diode to combat any inductive kickback.
Here's a diagram of that part of the board:
Click image for larger version. 

Name:	Teensy solenoid label.png 
Views:	7 
Size:	16.8 KB 
ID:	17965
Relay documentation
Diode documentation
The code for the whole project is complex, but for controlling the solenoid it's just Serial.write(ioPort, HIGH) to turn it on and Serial.write(ioPort, LOW) to turn it off.

The problem: There are several of these boxes, each with its own Teensy and solenoid, and all seem to operate the same except one. On that one, when the solenoid is powered (digital out from the Teensy pin set to HIGH), the LED on the Teensy dims considerably and flickers. It dims maybe half a second after the signal is started, stays dimmed while the solenoid is operating, and returns to normal when it's done. The Teensy seems to operate normally otherwise, but the difference in behavior caught my eye.

Since this problem only happens with one setup, I'm guessing some component has failed or is faulty, but I'd like to be sure it's not exacerbated by the design. Can anyone tell what the issue might be? Bad relay, bad diode? Should the grounds not be isolated?
One other thing I just thought of: should there be a resistor (even 10 ohm) between the Teensy pin and Teensy GND? Or is a direct connection (through the relay) acceptable?