Hide Forgot
In some cases the default time out of 5 seconds is too short when waiting for tomcat to restart. Instead of using a hard coded timeout, we should use a more dynamic way of detecting if tomcat has restarted. Spacewalk had a similar problem in their installer, which they solved. http://git.fedorahosted.org/git/?p=spacewalk.git;a=blob;f=spacewalk/setup/bin/spacewalk-setup;h=114817f6155637164dc04e8ea203c413de745e24;hb=28be9373d18952ef29b938175ac465a6e7d21b63#l1385
1385 sub wait_for_tomcat { 1386 my $hostname = shift; 1387 1388 for (my $i = 0; $i < 20; $i++) { 1389 IO::Socket::INET->new( 1390 PeerAddr => 'localhost', 1391 PeerPort => '8009', 1392 Proto => 'tcp' 1393 ) or last; 1394 sleep 5; 1395 } 1396 1397 for (my $i = 0; $i < 20; $i++) { 1398 my $retval = system("HEAD http://$hostname/ 2>&1 > /dev/null"); 1399 if ($retval) { 1400 sleep 5; 1401 } 1402 else { 1403 return; 1404 } 1405 } 1406 print "Tomcat failed to start properly or the installer ran out of tries. Please check /var/log/tomcat*/catalina.out for errors.\n"; 1407 return; 1408 }
Looks cool. Finally this problem gets solved ;-)
Comment #1 needs to be ported to python and added to cpsetup.
I don't think we can rely on HEAD system call which is provided by perl-libwww-perl, but we can simulate a HEAD call from within python: http://docs.python.org/library/httplib.html from the docs: >>> import httplib >>> conn = httplib.HTTPConnection("www.python.org") >>> conn.request("HEAD","/index.html") >>> res = conn.getresponse()
Fixed in 9d38c154297e760839934fb8333b4e0a4a6a9af4
VERIFIED, candlepin-tomcat6-0.4.27-1.fc14.noarch candlepin-0.4.27-1.fc14.noarch Set up candlepin according to: https://fedorahosted.org/candlepin/wiki/Setup on a slow computer. running the cpsetup: [root@localhost ~]# /usr/share/candlepin/cpsetup Dropping candlepin database Creating candlepin database Loading candlepin schema Writing configuration file Creating CA private key password Creating CA private key Creating CA public key Creating CA certificate Waiting for tomcat to restart... Candlepin has been configured. The "waiting for tomcat restart" took about 20 seconds (longer than the old 5 second wait) and did not error out.