Re: IDS unstable on Linux 2.2?
Posted in 1999
rich@no-annexia-spam.org wrote: : Hi: : Has anyone found IDS to be very unstable under : high load on Linux 2.2 systems? I have a test [...] As a follow up to this query, I have some code which demonstrates the bug. If anyone is running IDS on Linux 2.2 and can just quickly give this code a run to see if it works or doesn't work, I'd be grateful. Thanks in advance. Rich. ---------------------------------------------------------------------- #!/usr/bin/perl # # Copyright (C) 1999 Bibliotech Ltd., 631-633 Fulham Rd., London SW6 5UQ. # # $Id: directstress.pl,v 1.3 1999/06/11 10:26:53 rich Exp $ # # Change log: # # $Log: directstress.pl,v $ # Revision 1.3 1999/06/11 10:26:53 rich # Removed unneeded line. # # Revision 1.2 1999/06/11 10:25:58 rich # Added test script showing the bug. # # Revision 1.1 1999/06/10 16:49:02 rich # Added directstress program. # # Stress test the database directly (ie. without # intervening httpd). # Create a database called ``directstress'', # with the following tables: # # CREATE TABLE test1 ( # userid serial PRIMARY KEY, # username character varying(32) not null unique # ); # # CREATE TABLE test2 ( # userid int not null unique, # cookie character(32), # foreign key (userid) references test1 (userid) # ); # GRANT connect TO testuser; # GRANT all ON test1 TO testuser; # GRANT all ON test2 TO testuser; # # INSERT INTO test1 (userid, username) VALUES (1, 'richard_jones'); # INSERT INTO test2 (userid, cookie) VALUES (1, '1234'); # INSERT INTO test1 (userid, username) VALUES (2, 'someone_else'); # INSERT INTO test1 (userid, username) VALUES (3, 'and another'); $database = "directstress"; $user = "testuser"; $password = "password"; $test1 = "test1"; $test2 = "test2"; use DBI; use DBD::Informix; $nr_procs = 100; $nr_requests_per_proc = 1000000; for ($i = 0; $i < $nr_procs; ++$i) { if (fork == 0) { do_child (); } } wait; sub do_child () { my $db = DBI->connect ("dbi:Informix:$database", $user, $password) or die $DBI::errstr; my ($sth, $nr_rows); for ($j = 0; $j < $nr_requests_per_proc; ++$j) { $sth = $db->prepare ("select * from $test1 where userid=2000000", undef) or die $DBI::errstr; $sth->execute () or die $DBI::errstr; $nr_rows = count_rows ($sth); warn "incorrect number of rows from statement 1" if $nr_rows != 0; $sth->finish; $sth = $db->prepare ("select * from $test1 where username='richard_jones'", undef) or die $DBI::errstr; $sth->execute () or die $DBI::errstr; $nr_rows = count_rows ($sth); warn "incorrect number of rows from statement 2" if $nr_rows != 1; $sth->finish; $sth = $db->prepare ("update $test1 set username='richard_jones' where username='richard_jones'", undef) or die $DBI::errstr; $sth->execute () or die $DBI::errstr; $sth->finish; $sth = $db->prepare ("update $test2 set cookie='00826FFB7CC80B78B47F8E2D20D85310' where userid=1", undef) or die $DBI::errstr; $sth->execute () or die $DBI::errstr; $sth->finish; } undef $db; exit 0; } sub count_rows ($) { my $r = shift; my $count = 0; while ($r->fetchrow_arrayref) { $count++; } return $count; }