Steps to reproduce nodejs/node-v0.x-archive#5504. With either Vagrant/VirtualBox or plain EC2.
- Get Vagrant http://www.vagrantup.com/ and VirtualBox https://www.virtualbox.org/
- Save the other files here to a new directory:
Vagrantfile
,server.js
andclient.js
. - In the new directory:
vagrant up
vagrant ssh
git clone git://github.com/joyent/node.git
cd node
./configure
make
./node /vagrant/server.js
- Open another terminal to monitor the VM, in the new directory:
vagrant ssh
top
- Yet another terminal, local, in the new directory:
node client.js
Note:
- Node will spin up to 100% CPU and eat a lot of memory when the bug is triggered.
- This issue is very hard to reproduce when both the client and the server run on the same host.
- It won't always trigger with a smaller
content
Buffer.
- You need an AWS account and the AWS CLI tools for this.
- Create instance and a group for it, compile Node, run server.js:
ec2-create-group node-issue-5504 -d 'Node issue 5504'
ec2-authorize node-issue-5504 -P tcp -p 22 -s 0.0.0.0/0
ec2-authorize node-issue-5504 -P tcp -p 3000 -s 0.0.0.0/0
ec2-run-instances ami-7ee2ed0a -g node-issue-5504 -k <key pair> -t m1.small -z <availability zone>
ec2-get-console-output <instance id> # Get the host key
ec2-describe-instances <instance id> # Get the public domain name
ssh ec2-user@<public domain name>
sudo iptables -F
sudo yum install --assumeyes gcc gcc-c++ git
git clone git://github.com/joyent/node.git
cd node
./configure
make
wget https://gist.github.com/pepve/5694305/raw/037d20cbf34367dc8fd36d90102e50cb03954e7a/server.js
./node server.js
- In another terminal, also ssh to the instance, and run top
- Modify client.js to connect to the instance and run it locally
- After you're done, remove the instance and the group:
ec2-terminate-instances <instance id>
ec2-delete-group node-issue-5504