mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Ensure we dispose of MiniRacer::Context before forking daemons (#28361)
This commit updates `Demon::Base#start` to call `Discourse.before_fork` before forking. According to the docs in `mini_racer`, we need to "Dispose manually of all MiniRacer::Context objects prior to forking". This commit is motivated by a segmentation fault which we are seeing in production when killing a daemon process. Backtrace of the core dump includes traces of `mini_racer` so we think this is the cause. Note that we are not 100% sure if this will fix the issue.
This commit is contained in:
committed by
GitHub
parent
e82e255531
commit
10ff0ee0cc
@@ -64,15 +64,7 @@ initialized = false
|
||||
before_fork do |server, worker|
|
||||
unless initialized
|
||||
Discourse.preload_rails!
|
||||
|
||||
# V8 does not support forking, make sure all contexts are disposed
|
||||
ObjectSpace.each_object(MiniRacer::Context) { |c| c.dispose }
|
||||
|
||||
# get rid of rubbish so we don't share it
|
||||
# longer term we will use compact! here
|
||||
GC.start
|
||||
GC.start
|
||||
GC.start
|
||||
Discourse.before_fork
|
||||
|
||||
initialized = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user