Примерно 19 февраля мой сервер начал показывать ежечасно увеличивающиеся скачки ЦП:
I traced these to the node process which serves my website. Git shows no changes between Jan 12 and Feb 24. On Feb 24 I made the following upgrades:
- "mongoose": "^4.11.6",
+ "mongoose": "^5.9.2",
- "passport-local-mongoose": "^4.1.0",
+ "passport-local-mongoose": "^6.0.1",
- "jwt-simple": "^0.5.1",
+ "jwt-simple": "^0.5.6",
- "orm": "^5.0.2",
+ "orm": "^5.0.5",
By July my CPU was spending all its time at 100%
Some profiling revealed that session-file-store is either responsible or is being called by the responsible code:
Here's the call tree, which is probably informative, though I don't really understand it
The code in which I set up session-file-store is
const next = require("next")
const express = require("express")
const passport = require("passport")
const session = require("express-session")
const FileStore = require("session-file-store")(session)
const app = next({
dir: ".",
dev: config.dev
})
app
.prepare()
.then(() => {
server = express()
server.use(cookieParser())
server.use(
session({
secret: process.env.SESSION_SECRET,
store: new FileStore({
path: "/tmp/sessions",
secret: process.env.SESSION_SECRET
}),
resave: false,
rolling: true,
saveUninitialized: true,
httpOnly: true,
cookie: {
maxAge: 60000 * 60 * 24 * 7 * 4 // 4 weeks
}
})
)
server.use(passport.initialize())
server.use(passport.session())
passportConfig(passport)
Что-то в моей конфигурации объясняет, почему файл сеанса -магазин будет иметь почасовую работу с постоянно увеличивающимся объемом? Это ошибка паспорта-местного-мон goose?