There should be no limit to the length of a line.
OTOH there are a lot of subtle ways that file
locking can go wrong, and most of the time when I see
people offering advice on how to do it they get it
wrong. Therefore, your confidence notwithstanding,
I would suspect the locking routines.
For a discussion of what can go wrong, see RE: RE: Flock Subroutine or
Don't use unflock (flock 8). Ever.. See Simple Locking for a reasonably good
example of how to do it.
Incidentally if you can, I would suggest moving this to