Skip to content

hugo serve results in panic: non-positive interval for NewTicker #9165

@blackb1rd

Description

@blackb1rd

What version of Hugo are you using (hugo version)?

latest

Does this issue reproduce with the latest release?

Yes, but there is condition to reproduce.

  1. need to set maximum number of open files to low for hitting error too many open files on during running hugo
  2. run hugo serve without setting the poll interval

The issue is hit at:

func New(interval time.Duration) (FileWatcher, error) {
if watcher, err := NewEventWatcher(); err == nil {
return watcher, nil
}
return NewPollingWatcher(interval), nil
}

if there is error return from below code with "too many open files":

 	if watcher, err := NewEventWatcher(); err == nil { 
 		return watcher, nil 
 	} 

Then it will create NewPollingWatcher with interval = 0

 	NewPollingWatcher(interval), nil 

And then it will panic with 0 as input:
https://github.com/golang/go/blob/c2397905e027cdbab3a28d02813adcb82368422c/src/time/tick.go#L24

This issue may be the same issue as #8744

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions