[rabbitmq-discuss] ERL crashes when messages are being pumped into a queue under win32 envir
Ming Li
mli at rmmsoft.com.cn
Wed Mar 30 10:40:53 BST 2011
1. using RabbitMQ2.4.0(windows bundle).winxp, creates an exchange and a queue.
2. use multiple sender to send messages into the created queue, only a single receiver receiving message from the same queue.
3. while running, what i discovered is that the ERL's RAM usage continue to increase and then crash when it reaches a certain percentage
Is there a way to prevent it from crashing?
Here are my receiver and sender source code:
Receiver:
RabbitMQ.Client.ConnectionFactory cf = new RabbitMQ.Client.ConnectionFactory();
cf.UserName = RabbitMQ.Client.ConnectionFactory.DefaultUser;
cf.Password = RabbitMQ.Client.ConnectionFactory.DefaultPass;
cf.VirtualHost = RabbitMQ.Client.ConnectionFactory.DefaultVHost;
cf.Protocol = RabbitMQ.Client.Protocols.FromEnvironment();
cf.HostName = "192.168.3.43";
cf.Address = "192.168.3.43";
cf.Port = 9007;
RabbitMQ.Client.IConnection IC = cf.CreateConnection();
RabbitMQ.Client.IModel IM = IC.CreateModel();
string qu = "Queue11"/*IM.QueueDeclare()*/;
IM.QueueDeclare(qu, false, false, true, null);
IM.BasicGet(qu, true);
IM.BasicReturn += new RabbitMQ.Client.Events.BasicReturnEventHandler(IM_BasicReturn);
RabbitMQ.Client.QueueingBasicConsumer _consumer = new RabbitMQ.Client.QueueingBasicConsumer(IM);
IM.BasicConsume(qu, true, _consumer);
int iCount = 0;
while (true)
{
RabbitMQ.Client.Events.BasicDeliverEventArgs e = null;
object obj = _consumer.Queue.Dequeue();
if (obj == null || (e = obj as RabbitMQ.Client.Events.BasicDeliverEventArgs) == null)
{
}
}
Sender:
RabbitMQ.Client.ConnectionFactory cf = new RabbitMQ.Client.ConnectionFactory();
cf.UserName = RabbitMQ.Client.ConnectionFactory.DefaultUser;
cf.Password = RabbitMQ.Client.ConnectionFactory.DefaultPass;
cf.VirtualHost = RabbitMQ.Client.ConnectionFactory.DefaultVHost;
cf.Protocol = RabbitMQ.Client.Protocols.FromEnvironment();
cf.HostName = "192.168.3.43";
cf.Address = "192.168.3.43";
cf.Port = 9007;
SingleQuoteResponse res = new SingleQuoteResponse();
T_Quote tq = new T_Quote();
tq.SecurityDesc = "ssssssssss";
res.Quote = tq;
RabbitMQ.Client.IConnection IC = cf.CreateConnection();
RabbitMQ.Client.IModel IM = IC.CreateModel();
for (int j = 0; j < 100000000; j++)
{
IM.BasicPublish("", "Queue11", null, ESHelper.asES(ref res).ToBytes());
Console.WriteLine("Sended :" + j.ToString());
}
if (IM != null)
{
IM.Close();
IM.Dispose();
}
if (IM != null)
{
IC.Close();
IC.Dispose();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110330/40cc68c9/attachment-0001.htm>
More information about the rabbitmq-discuss
mailing list