nodejs error: socket hang up

socket hang up 的可能原因有很多,大多是服务器资源不足引起。

检查 ulimit -n (所有的 port process 资源受它限制)
sudo lsof -i|wc -l
检查 memory (内存耗尽也会出错)
free -m


location / {
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-NginX-Proxy true;
  proxy_set_header Host $http_host;
  proxy_pass; // nodejs server 
  proxy_redirect off;


memory error
ulimit error



此时应该会立刻进入bootloader ,如果依然出现华为logo,请重复上述步骤。


#import <UIKit/UIKit.h>
#import "AppDelegate.h"

// For debugger_ptrace. Ref:
#import <dlfcn.h>
#import <sys/types.h>

// For debugger_sysctl
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/sysctl.h>
#include <stdlib.h>

// For ioctl
#include <termios.h>
#include <sys/ioctl.h>

// For task_get_exception_ports
#include <mach/task.h>
#include <mach/mach_init.h>

typedef int (*ptrace_ptr_t)(int _request, pid_t _pid, caddr_t _addr, int _data);

#if !defined(PT_DENY_ATTACH)
#define PT_DENY_ATTACH 31
#endif // !defined(PT_DENY_ATTACH)

@brief This is the basic ptrace functionality.
void debugger_ptrace()
handle = dlopen(0, RTLD_GLOBAL | RTLD_NOW);
ptrace_ptr_t ptrace_ptr = dlsym(handle, "ptrace");
ptrace_ptr(PT_DENY_ATTACH, 0, 0, 0);

- 阅读剩余部分 -

How to Disable System Integrity Protection (rootless) in Mac OS X

Enable or Disable System Integrity Protection Rootless in Mac OS X

Apple has enabled a new default security oriented featured called System Integrity Protection, often called rootless, in Mac OS from versions 10.11 onward. The rootless feature is aimed at preventing Mac OS X compromise by malicious code, whether intentionally or accidentally, and essentially what SIP does is lock down specific system level locations in the file system while simultaneously preventing certain processes from attaching to system-level processes.

While the System Integrity Protection security feature is effective and the vast majority of Mac users should leave rootless enabled, some advanced Mac users may find rootless to be overly protective. Thus, if you’re in the group of advanced Mac users who do not want SIP rootless enabled on their OS X installation, we’ll show you how to turn this security feature off.

- 阅读剩余部分 -