Is it normal for MySQL to gradually increase memory usage over time?

Is it normal for MySQL to increase memory usage over time? See image below of my server’s memory usage over the last two weeks. After “service mysql restart” it drops to 40%. The database is used by a node.js app.

Server has 4GB of RAM with below additions to mysqld.cnf:

innodb_ft_min_token_size = 1
ft_min_word_len = 1
innodb_buffer_pool_size = 3G
innodb_buffer_pool_instances = 5
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_log_file_size = 128M
innodb_flush_method = O_DIRECT
max_connections = 300
long_query_time = 1
innodb_ft_enable_stopword = 0

Thank you!

Go to Source
Author: steven

Error: Cannot read property ‘user’ of null when calling passport.serializeUser

so I have the next in my passport.js file:

const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;
var connection = require('./database');
const User = require('./models/user');

const verifyCallback = (username, password, done) => {

  User.findUser(username).then((user) => {
    if(!user)
      return done(null, false);

    const isValid = User.validPassword(password, user[0].password).then((isValid)=>{

      if(isValid)
        return done(null, user);
      else
        return done(null, false);

    })
  })
  .catch((err) =>{
    done(err);
  });
};

const strategy = new LocalStrategy(verifyCallback);

passport.use(strategy);

passport.serializeUser((user, done) => {
  console.log(user + "n" + user.id);
  done(null. user.id);
});

passport.deserializeUser((userId, done) => {
  User.findById(userId)
    .then((user) =>{
        done(null, user)
    })
    .catch(err => done(err));
})

Everything works fine until the function passport.serializeUser which return the error Cannot read property 'user' of null
I don’t know where is the user param coming from, I was following a tutorial but the guy didn’t explained. How should I solve that error?

Go to Source
Author: Alex UnLimited