Dirk
I had this very bug in Lsyncd myself where it was quite quite hidden
behind the scenes. In shortened pseudocode
FOR 1 TO number of listeners for filedescriptors DO
call the handling function for a filedescriptor number i.
One of the fd handlers had this:
IF end of pipe THEN
remove meself from list of filedescriptors....
Hard to spot when browsing the code, but obviously made it kaboom. I
had to do a flag "main code is just iterating through the fds" and in
the remove fds had to push it on the stack "wants to be removed"
instead of removing it right away, and after the iterator finished to
work through the stack of fds wanting to be gone.
So I take back my previous statement that # is currently the only big
trap for newbies. Modifing tables while iterating is another, or
assigning anything to a loop variable. The only way I see to make Lua
more bulletproof would be a readonly flag.