On the causes of errors in the execution of a piece of nodejs code

const http = require("http");
const urllib = require("urllib");

const keepaliveAgent = new http.Agent({
  keepAlive: true,
});
const server = http.createServer((req, res) => {
  res.end("Hello World, " + req.connection.remotePort);
});
server.on("clientError", (err, socket) => {
  socket.end("HTTP/1.1 400 Bad Request\r\n\r\n");
});
server.listen(3000);

function request() {
  urllib.request("http://127.0.0.1:3000", {
    agent: keepaliveAgent,
    dataType: "text",
  }, (err, data, res) => {
    if (err) {
      console.error("error: %s, status: %s", err, res.status, res);
      throw err;
    }
    console.log("status: %s, data: %s", res.status, data, res);
  });
}



setInterval(request, 5000);
request();

error log is as follows:

clipboard.png

Mar.03,2021

of course, an error will be reported when the request starts before the listening is successful.

server.listen(3000,()=>{
    setInterval(request, 5000);
    request();
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e48abd-44ce0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e48abd-44ce0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?