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

Memory leak, somewhere on Stateless #1

Open
ghostbar opened this issue Sep 14, 2013 · 2 comments
Open

Memory leak, somewhere on Stateless #1

ghostbar opened this issue Sep 14, 2013 · 2 comments

Comments

@ghostbar
Copy link

Hi Niels,

I have been using this for quite some time (like one month) and started to have memory leaks. Some times it completed the task (specially at the beginning) but finally there was a huge memory leak that made my app that uses top 73MB go to +1GB on RAM if launched to Stateless.Messages.Create in parallel.

This is the prototype I was using to launch this. I know the way the prototype is structured is not the issue because now I'm doing the request by myself with request in that very same prototype, just changed groupme with a request call.

SMSController.prototype.sendMessage = function(id, message, callback) {
  var self = this,
       gm = require('groupme').Stateless;

  if (id == null || id === '') {
    self.app.log.error("sms/ctrl#sendMessage: there's no id for sending the message");
    return callback(new Error("There's no ID for sending the message"));
  }

  self.app.log.debug({
       data: {
         id: id,
         message: message
       }
     }, "sms/ctrl: sending message");

  if (message.source_guid == null) {
    message['source_guid'] = 'supposedlyanuniqueidentifier';
  }

  return gm.Messages.create(this.app.vars.groupme.token, id, { message: message }, function(err, response) {
    if (err) {
      self.app.log.error({ data: err }, "sms/ctrl#sendMessage: ");
      return callback(err);
    }
    self.app.log.debug(message, "sms/ctrl: message sent");
    return callback(null);
}

FWIW: node v0.10.17. Tested on MacOS X and Linux.

Kind regards.

@njoubert
Copy link
Owner

Hi Jose! First of all - AWESOME! I'm happy that people are getting mileage out of my code! What are you using this for?

Thanks for the bugfix, I'll look into this at the end of this week - I'm a bit swamped with other work at the moment but I'll see if I can fix this issue as soon as possible.

@ghostbar
Copy link
Author

I can't tell yet. I had to write my own requests instead (we are just using the create Message, so it was easy) because this was killing our server :(

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

2 participants