Anybody else getting a lot of unnecessary "Change detected, rebuilding site."?

Hi, for the last 2 versions of Hugo sometimes when I run the dev server every few seconds it rebuilds even when there are not any new files/saves/etc.

here are my current stats:
Hugo Static Site Generator v0.75.1/extended darwin/amd64 BuildDate: unknown
editing in VSCode (if that matters)

and, to be honest, this behaviour seems to be intermittent and I’m not detecting any pattern…

Any suggestions?

Yeah, happens with me too. I’m running the same setup as stated above, except, on Windows.

I also wondered why that’s happening, but, it doesn’t bother me much. I can live with it. But, if there’s a solution, would be great.

Is your VSCode set to save every x seconds or on focus leave? That was a problem with my IDE (not Code).

Well, in my case, it’s happening with images and videos that reside inside my content/projects/project-name/assets. So, I don’t think it’s VSCode.

I’ve checked auto save, and that it off, from what I can tell…

maybe it is the images? i have a fairly image -heavy site and am taking full advantage of hugo’s image processing.

Hi, I have the same issue going on and same setup. Autosave is off in VSC. Could you folks explain what you mean by images causing this? I do have images on the site, but I’m not in the middle of editing them. Crazy reload every two seconds was happening before I had any sort of image processing(resizing) added.

Yeah, it’s getting worse by updates probably. During my 0.74 times, it wasn’t as frequent for me (or maybe, my website was very basic back then). But, with 0.76, it’s more frequent. I have noticed some pattern in my case though. If I leave the server on for long time (the threshold is unknown) and then if I expand my minimised VSC window, I get this change detected for almost all my files in static and assets. These files are photos, videos, fonts, etc., basically, the files that aren’t really changing, but, a lot of changes are triggered.

Experiment:

  1. Terminate all code editors, image editors, backup programs, etc.
  2. Run hugo server

Result?

Here’s my results after about 40 minutes of testing:

As I said in the previous reply of mine, I get this message if I leave the server running for long. So, I started the server in VSC Terminal and kept a file (already saved) open. Then I minimised the VSC window and carried on with my other work (nothing to do with my website folder). All the disk I/O is happening outside that of project folder. I’m uploading files to Drive, creating some vector graphics, etc. Then, I returned to VSC and opened another file from my website in the editor and just as I opened it, I got the first change detected for the newly opened file, followed by:

Change detected, rebuilding site.
2020-10-14 17:41:02.684 +0530
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\_default\\_markup\\render-link.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\_default\\baseof.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\_default\\single.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\index.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\index.json": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\page\\404.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\page\\contact.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\page\\offline.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\page\\search.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\partials\\hero.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\partials\\metadata.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\partials\\pagination.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\partials\\toc.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\robots.txt": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\shortcodes\\audio.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\shortcodes\\image.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\shortcodes\\video.html": WRITE
Template changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\layouts\\sitemap.xml": WRITE
Total in 258 ms

Change of Static files detected, rebuilding site.
2020-10-14 17:41:03.683 +0530
Syncing fonts to C:\Users\Hrishikesh\Desktop\Portfolio\
Syncing fonts\roboto to C:\Users\Hrishikesh\Desktop\Portfolio\
Syncing fonts\roboto\cyrillic-ext to C:\Users\Hrishikesh\Desktop\Portfolio\
Syncing fonts\roboto\cyrillic to C:\Users\Hrishikesh\Desktop\Portfolio\
Syncing fonts\roboto\greek-ext to C:\Users\Hrishikesh\Desktop\Portfolio\
Syncing fonts\roboto\greek to C:\Users\Hrishikesh\Desktop\Portfolio\
Syncing fonts\roboto\latin-ext to C:\Users\Hrishikesh\Desktop\Portfolio\
Syncing fonts\roboto\latin to C:\Users\Hrishikesh\Desktop\Portfolio\
Syncing fonts\roboto\vietnamese to C:\Users\Hrishikesh\Desktop\Portfolio\
Syncing images to C:\Users\Hrishikesh\Desktop\Portfolio\

Change detected, rebuilding site.
2020-10-14 17:41:04.006 +0530
Total in 12 ms

Change detected, rebuilding site.
2020-10-14 17:41:08.683 +0530
Rebuilt in 16986 ms

Change of config file detected, rebuilding site.
2020-10-14 17:41:27.673 +0530

Change detected, rebuilding site.
2020-10-14 17:41:27.713 +0530
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\animated-sketches\\assets\\vid3-480p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\animated-sketches\\assets\\vid3-720p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\website1\\Build\\Export.wasm.code.unityweb": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\website1\\Build\\Export.wasm.framework.unityweb": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\cover-low.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\cover.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\img1-low.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\img24.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\img25-low.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\img1.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\img2-low.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\img2.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\og.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\twitter.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\website1\\Build\\UnityLoader.js": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\vans-match-3\\assets\\website1\\Build\\Export.json": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\img25.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\img26-low.png": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\windows-10-m\\assets\\vid1-1440p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\windows-10-m\\assets\\vid1-144p.mp4": WRITE
Total in 717 ms

Change detected, rebuilding site.
2020-10-14 17:41:28.722 +0530
Rebuilt in 2862 ms
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\goodbye-adam\\assets\\vid1-1080p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\windows-10-m\\assets\\vid1-480p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid1-1080p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\carry-on-bot\\assets\\vid1-1440p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\LockHandle.svg": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\LogoIcon.svg": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\LogoText.svg": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\ServerDisk.svg": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\ShareCircle.svg": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\ShareLine.svg": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\SpeedBase.svg": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\SpeedIndicator.svg": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\Sync.svg": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\HYPE-664.full.min.js": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\HYPE-664.waypoints.min.js": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\PIE.htc": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\blank.gif": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\favicon.ico": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\website2\\Dropbox.hyperesources\\dropbox_hype_generated_script.js": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\goodbye-adam\\assets\\vid1-1440p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\goodbye-adam\\assets\\vid1-144p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\goodbye-adam\\assets\\vid1-2160p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\goodbye-adam\\assets\\vid1-240p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\goodbye-adam\\assets\\vid1-360p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\goodbye-adam\\assets\\vid1-480p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\goodbye-adam\\assets\\vid1-720p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\windows-10-m\\assets\\vid1-720p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid1-144p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid1-240p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid1-360p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid1-480p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid1-720p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid2-1080p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid2-144p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid2-240p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid2-360p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid2-480p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\vid2-720p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\aud1.mp3": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\aud2.mp3": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\carry-on-bot\\assets\\vid1-144p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\carry-on-bot\\assets\\vid1-2160p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\carry-on-bot\\assets\\vid1-240p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\carry-on-bot\\assets\\vid1-360p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\carry-on-bot\\assets\\vid1-480p.mp4": WRITE
Source changed "C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\carry-on-bot\\assets\\vid1-720p.mp4": WRITE

Change detected, rebuilding site.
2020-10-14 17:41:32.540 +0530
Total in 6266 ms
Rebuilt in 3203 ms

Now these files weren’t even touched by me. Maybe behind the scenes something is happening, but, I don’t know what. This is my usual and typical day usage of Hugo. I am working on the website, keep the server on and go on to create some graphic or collect some images, etc. for the website content and forget that the server is on. When I return, that’s what happens.

I don’t know if the others are also facing the issue under same circumstances, but, these were my findings about this case.

Terminate OneDrive and repeat the experiment.

I don’t have OneDrive installed. The uploading files to Drive part, I meant, I’m manually uploading files from my External Hard Disk to Google Drive using Chrome. My website’s folder exists on the C:\ as you can see in the console log.

This looks like Windows, which I used last time in 2004. There must be tools to “track file access on windows”. Type it into Google and see what comes out. You basically want a list of programs and processes that access C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\carry-on-bot\\ and C:\\Users\\Hrishikesh\\Desktop\\Portfolio\\content\\projects\\dropbox\\assets\\ (is that a Dropbox dropbox or just a folder named dropbox? If it’s a Dropbox dropbox translate @jmooring’s comment from OneDrive to Dropbox))

Someone is touching your files and you want to find out who (process/program) this is :wink:

This might help: https://security.stackexchange.com/questions/6702/monitoring-file-access-on-windows

It’s just a folder named Dropbox. I don’t have any cloud sync services installed on the device.

Alright. I’ll update the thread with my findings in a few hours.

But if that’s the case, it should also rebuild when VSC is minimised. That doesn’t happen (according to the console). It happens only when I reopen the minimised window and open a file in the editor. In any case, I’d still check if any app or something is messing up here.

I would suspect some kind of plugin in the IDE. If it has a debug mode then disable everything and re-run.

Note: Up to now only people with VSCode are reporting that issue in this thread. It’s definitely not coming up in PhpStorm/WebStorm or Sublime Text. Might be worth a ticket over in whatever Code has as support forum.

Makes sense. I’d first check if the files are getting changed or move this topic to VSC forums.

About this, well, I have some websites made in Gatsby. I use VSC for that too. Such kind of triggers don’t occur in it. Yeah, those are different websites, with different files and content structures and frameworks to begin with. But, I ruled out VSC being the cause of this trouble because of the fact that it doesn’t happen in Gatsby. For me, my Gatsby websites reload only when I save a file myself in one of the watched directories. I’ll still go ahead and monitor VSC’s activities too.

See my earlier suggestion:

  1. Terminate all code editors, image editors, backup programs, etc.
  2. Run hugo server

If the problem doesn’t recur, start enabling things one-by-one until you can reproduce the problem.

This is what Hugo uses to watch files/directories:

I tried that. I closed all apps, left the computer table for about half an hour, just ket Hugo server running through CMD and as soon as I opened VSC and a loaded a file in it from my website folder, the changes got triggered.

However, it didn’t trigger when I opened a single file in VSC. It only got triggered when I opened the entire folder and then loaded a file in it. It’s probably being caused because VSC is then checking the changes with my Git repo. Just a guess. So, probably VSC is accessing and checking the changes of the entire folder and that’s getting detected by fsnotify.

Thanks for that info. I found a kinda similar issue for fsnotify: https://github.com/fsnotify/fsnotify/issues/323. Not saying this should be immediately tried or considered as a bug, at least not till it’s confirmed as the cause of the problem.

I tried Microsoft’s Process Monitor without much luck. It didn’t mention any new process that wrote to any of those files, but, Hugo still detected some changes. However, I was filtering the events that included only ‘Write’ access because there were a lot of events otherwise that were increasing by every few milliseconds. Probably, one of them has an answer, but, it’s too difficult to read the list.

Sadly, even after a lot of trials and errors, the exact cause is still undetermined. If at all someone ends up with more information to narrow this down, that’d be great.