Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect.session()의 leak memory 문제. #341

Open
kimalec opened this issue Aug 15, 2015 · 1 comment
Open

connect.session()의 leak memory 문제. #341

kimalec opened this issue Aug 15, 2015 · 1 comment

Comments

@kimalec
Copy link
Member

kimalec commented Aug 15, 2015

NODE_ENV=production 으로 설정하고 실행하면 아래와 같은 에러 메세지가 나온다.

Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
@kimalec
Copy link
Member Author

kimalec commented Aug 15, 2015

connect-mongo 라는 것으로 해결가능하다고 하나, 검토해보니 에러가 발생하고, 추가 수정이 필요해 보임.

mongoose.connect(connectInfo);

app.use(session({
    secret: 'WizardFactory',
    store: new (require('connect-mongo')(session))({ mongooseConnection: mongoose.connection })
}));

아래와 같은 에러가 발생함.

TypeError: Cannot read property 'connect.sid' of undefined
    at Layer.session [as handle] (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express-session/index.js:122:32)
    at trim_prefix (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:240:15)
    at /Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:208:9
    at Function.proto.process_params (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:269:12)
    at next (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:199:19)
    at Layer.expressInit [as handle] (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/middleware/init.js:23:5)
    at trim_prefix (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:240:15)
    at /Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:208:9
    at Function.proto.process_params (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:269:12)
    at next (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:199:19)
warn: { statusCode: 500,
  body: '"TypeError: Cannot read property 'connect.sid' of undefined\\n    at Layer.session [as handle] (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express-session/index.js:122:32)\\n    at trim_prefix (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:240:15)\\n    at /Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:208:9\\n    at Function.proto.process_params (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:269:12)\\n    at next (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:199:19)\\n    at Layer.expressInit [as handle] (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/middleware/init.js:23:5)\\n    at trim_prefix (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:240:15)\\n    at /Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:208:9\\n    at Function.proto.process_params (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:269:12)\\n    at next (/Users/aleckim/WebstormProjects/BlogSyncer/node_modules/express/lib/router/index.js:199:19)"',
  url: 'http://www.justwapps.com/kakao/bot_posts/updateToken?userid=558f7b04900a41fc8b815800' } cName=BlogBot, fName=_updateAccessToken, userId=558f7b04900a41fc8b815800

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant