Skip to content

Instantly share code, notes, and snippets.

@futurechimp
Created September 6, 2011 10:37
Show Gist options
  • Save futurechimp/1197232 to your computer and use it in GitHub Desktop.
Save futurechimp/1197232 to your computer and use it in GitHub Desktop.
100% CPU usage in xmpp4r
# Steps to repro:
#
# Set up two XMPP accounts:
# "account1@yourserver.org" and "account2@yourserver.org"
# Both with password "password"
#
# Start the sinatra webserver server using:
#
# ruby -rubygems xmpp4r_harness.rb
#
# We can now freak out the server with:
# ab -c 25 -n 1000 http://localhost:4567/hi
# AUTH AND ACCOUNT INFO
JABBER_SERVER = "yourserver.org"
ACCOUNT1 = "account1"
ACCOUNT2 = "account2"
# REPRO HARNESS
require 'rubygems'
require 'xmpp4r'
require 'xmpp4r-simple'
require 'sinatra'
get '/hi' do
jabber = Jabber::Simple.new("#{ACCOUNT1}@#{JABBER_SERVER}", "password")
jabber.deliver("#{ACCOUNT2}@#{JABBER_SERVER}", "hi there!")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment