You're correct that the rail needs to continually have its stress managed. This could be cutting the rail and adding a new piece, or removing a bit. This is a fairly labor intensive and costly process so the railroads were very interested in coming up with a way to determine when a buckle or break was most likely.
Buckles and breaks were most common just after a train had left a section of track. The normal approach was to issue slow orders when the temperature got too high (buckle) or too low (break). So there was a lot of interest in finding more accurate ways to determine when slow orders were necessary and to optimize when to add/remove rail.
AFAIK this problem is still outstanding. The product I worked on years ago never quite succeeded. Railroads are a harsh environment.
Breaks are "easy" to find, the problem would be buckles where the track is still "connected" but it is one rail is no longer equidistant from the other rail.
Only if track circuits are used in the first place. Modern installation tend to prefer axle counters, and even with track circuits some designs use only one rail for the track circuit and therefore wouldn't be able to detect breaks in the other rail.
Buckles and breaks were most common just after a train had left a section of track. The normal approach was to issue slow orders when the temperature got too high (buckle) or too low (break). So there was a lot of interest in finding more accurate ways to determine when slow orders were necessary and to optimize when to add/remove rail.
AFAIK this problem is still outstanding. The product I worked on years ago never quite succeeded. Railroads are a harsh environment.