Hugo server render to memory still requires lock file?

Reading through the documentation I understand the purpose of the .hugo_build.lock to be a lock to avoid multiple hugo servers to write to the same output directory. This makes sense to avoid multiple servers making a mess of the output.

Do I understand this correctly?

If so, why does the hugo server want to check/create this lock file if it is rendering to memory?
There it is impossible for multiple servers to make a mess of things because each has it’s own unique output location (in memory).

I ran into this when I created a simple docker image to run hugo in where I mounted the website directory as readonly. I got an error the filesystem being readonly.

For reference the docker compose I have (the Dockerfile simply builds an image with hugo and go and other tools).

services:
  local-site-hosting:
    build: .
    volumes:
      - ./website:/website:ro
    working_dir: /website
    command: hugo server --bind 0.0.0.0 --renderToMemory -c /website --logLevel debug
    ports:
      - "1313:1313"

I can’t speak to the necessity of the lock file regardless of whether you are rendering to memory or rendering to disk, but (you may already be aware of this) you can disable lock file creation in your site configuration or via CLI flag.

I do know that the lock file creation was implemented in v0.89.0, and at that point in time the default behavior when running hugo server was to render to memory. We changed the default behavior to render to disk in v0.123.0.

This issue comment is relevant:
https://github.com/gohugoio/hugo/issues/9056#issuecomment-946003087

I was not yet aware of the --noBuildLock feature.
Thanks, this will surely fix my usecase.

I did some more searching and found this comment in the code:

	// Used to control concurrency between multiple Hugo instances, e.g.
	// a running server and building new content with 'hugo new'.
	// It's placed in the project root.

So apparently there are also problems when running a server (with the site only going into memory) and the creation of new pages. I did not expect that because I expect that creating a new page is as simple as simply creating a new source file.