Running on node-js causes a memory leak
rodolfo3 opened this issue · comments
Setting it up in a running server-side-rendering app causes the memory grows constantly:
(it goes down when the server restarts the node process due memory restrictions)
The only difference is that I setup Raven globally:
global.Raven = require('raven');
I do this because I setup differently on client-side.
My store middlewares are:
import { createStore, applyMiddleware, compose } from 'redux';
import createRavenMiddleware from 'raven-for-redux';
import thunk from 'redux-thunk';
import rootReducer from '../reducers';
const composeEnhancers = (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;
const configureStore = (preloadedState = {}) => createStore(
rootReducer,
preloadedState,
composeEnhancers(
applyMiddleware(thunk),
applyMiddleware(createRavenMiddleware(Raven)),
),
);
In my packages.json, I have these versions:
"raven-for-redux": "^1.3.1",
"react-redux": "^5.0.3",
"redux": "^3.6.0",
"redux-thunk": "^2.2.0",
This behavior happens on nodejs 8.9.4
and 10.3.0
.
Is it because it calls Raven.setDataCallback
each store creation?
The it will create and add a new function to every store creation (with happens a lot on server-side-rendering)
Looks like the same issue as this: #50
This library is not compatible with Node Raven, since Node Raven has a different API. I would suggest you conditionally omit the raven-for-redux
middleware when server rendering.