Some dogs are prone to obsessive compulsive behaviors like tail chasing, chasing lights and shadows, or sucking on things. A few questions to ask are 1) are they just bored because there is literally nothing else to do? 2) do they do it even when offered the option of doing another behavior, like playing with you or another dog? 3) do they seem to go into a trance-like state while doing it? and 4) do they do it to the point of exhaustion, and still try to keep doing it?
If the answer to number 1 is yes, then provide other options. Training, toys, food toys, or food puzzles can all help combat boredom.
If the answer to number 1 is no, and the answers to numbers 2 and/or 3 and/or 4 are yes, then the odds of it being an OCD behavior is very likely, and consulting your vet about medication and treatment would be a good idea.