Development server consistently dying - 'V8 Isolate was forked'

AI 生成的摘要

gdpelican reported a recurring issue where the Discourse development server crashes with the error “WARNING: V8 isolate was forked,” occurring regularly during local development. sam inquired if the server was running in non-clustered mode. gdpelican confirmed that the default thin server was being used and that switching to puma in single mode appeared to resolve the immediate crashes. gdpelican suggested removing thin from the dependencies or setting puma as the default handler. sam agreed, noting it was time to drop thin entirely, and confirmed the dependency was removed. This change also revealed a secondary issue where silencer middlewares were not thread-safe, causing log disabling problems in development mode. sam subsequently fixed the thread safety issue via a specific commit (https://github.com/discourse/discourse/commit/a898d6a02a28406bfd0033a5e4d044a0ecbe71f9).

I’ve been having some fairly consistent trouble with the Discourse development server throwing the following error message, which appears to kill the server pid.

WARNING: V8 isolate was forked, it can not be disposed and memory will not be reclaimed till the Ruby process exits.

It’s not so big a deal to need to restart the server now and again, but it seems to happen fairly regularly on my machine during development. Any steps to avoid this, or a way to turn it off in development mode?

Are you using puma in a non-cluster mode?

Oh, hm. Looks like it’s picking up ‘thin’ as the default rails server (I’m just running bundle exec rails s from the project root; can’t be bothered with a Vagrant or anything)

But if I do specify puma explicitly, looks like it spins up in single mode:

Do you still get the issue when using puma?

Haven’t noticed this over the past couple days using Puma. I see Discourse includes both thin and puma in the Gemfile; does it make sense to either run both with the same server, or specify Puma as the default app server using Rack::Handler.pick or something similar?

I actually think it may be time to drop thin from the dependencies. Going ahead and doing that now.

EDIT: this is now done, we no longer carry an unloaded dependency to event machine … so yay!

Note: one thing that dropping thin did bring up is that our silencer middlewares were not thread safe. That got super annoying in dev mode cause logs would keep getting disabled.

I fixed that per:

https://github.com/discourse/discourse/commit/a898d6a02a28406bfd0033a5e4d044a0ecbe71f9