Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6106895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:07:42+00:00 2026-05-23T14:07:42+00:00

The ulimit on my system is 1024. I have come across many posts regarding

  • 0

The ulimit on my system is 1024. I have come across many posts regarding the same error but no concrete answer. I also want to know if this is a node/node-mysql issue and not to do with my code. I will post a snippet of my code here:

exports.fn1  = function(req,res,host,user,password,database){
        var client = connectDB.connectDatabase(host,user,password,database);
                fn2();

    function fn2() {
        client.query(
            'select statement', args,
            function selectCb(error, result, fields) {
                if (error) {
                    console.log('ERROR');
                    client.end();
                    return;
                }
              
                if(not timeout) {
                    setTimeout(function(){
                                    
                                    fn2();
                               },5000);
                }
                
                else {
                    res.writeHead(200, {'Content-Type': 'text/plain'});
                    res.write(somedata);
                    res.end(); 
                    client.end();   
                }


        });
        }
    }
};

connectDB is a module I wrote which does the db connections

var Client = require('mysql').Client; 

exports.connectDatabase = function(host,user,password,database) {
    var client = new Client(); //Database connection object
    //Credentials for DB connection
    client.host = host; 
    client.user = user;
    client.password = password;
    client.database = database;

    client.connect(function(error, results) {
        if(error) {
          console.log('Connection Error:');
          return;
        }
    });
    return client;
}

Am I doing something wrong with node.js here or is it a driver/node.js problem? Thanks for the help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:07:43+00:00Added an answer on May 23, 2026 at 2:07 pm

    I think you should be using closures more. References directly to fn2 are going to be using the named object, which will keep it from going out of scope. References to the same code through a closure will cause a layer of anonymity, which will allow the references to exit scope gracefully and get garbage collected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long running process which monitors the system and prints periodic logs.
why i could not find ulimit command in esehll mode but M-x ansi-term had
I created 10000 files - my default limit was ulimit -n 1024 - I
I have a very old linux system and installed java and play framework. When
I am working on a PC running CentOS as its operating system. I also
I am getting this error in my program... mprotect: Cannot allocate memory ulimit -a
EDIT: I now have a solution, but I'd really apprecite a concise description of
I have a RHEL 5 system with a fresh new hard drive I just
I have the following script: cat > /tmp/script.sh <<EndOfScript #!/bin/sh ulimit -n 8192 run_app
When running my application I sometimes get an error about too many files open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.