I have seen posts on the topic of getting "??" in the modeline instead of the line number. However despite my best efforts I can't get rid of the problem.
I have put those settings in my config:
(setq line-number-display-limit nil)
(setq line-number-display-limit-width most-positive-fixnum)
I'm pretty sure they help, sometimes now it's OK. But at least half of the time it's not. It's funny, I made myself a test file and it's kind of randomly working or not...
I'm using spacemacs
and put my config on github.
By the way, this is the relevant code in spacemacs if that helps...