From Bugzilla Helper: User-Agent: Mozilla/4.77 [en] (Windows NT 5.0; U) Description of problem: Linux 7.0 is not responding to a local telnet session consistantly. I run the following script and get various reactions: 1 is to hang after login waiting for a prompt to be returned. 2. It runs to completion without a problem. I'm running the stock perl shipped with 7.0 and Net::Telnet from CPAN. I run the follwing script: use Net::Telnet (); $controller - 'linux.strings.com'; $cmd="ls"; @respstring = remotex($controller,$cmd); print @respstring; exit(0); #=========================== sub remotex { $dump_log = "/tmp/dump_log"; $input_log = "/tmp/input_log"; $output_log = "/tmp/output_log"; my $username = "davidk"; my $password = "asdfghj"; my ($host,$command) = @_; print("host=$host, command=$command\n"); my $tel = new Net::Telnet ( Host => $host, Dump_log => $dump_log, Input_log => $input_log, Output_log => $output_log, Timeout => 300, Prompt => '/\{CDSQA\] /'); #Prompt => '/bash-2.04\$/'); #Prompt => '/tcsh /'); $tel -> login($username, $password); my @result = $tel -> cmd($command); return @result; } I might have made a typo but it works. If I set the prompt to [CDSQA] with bash shell it does not work - occasionally does - same with the other settings I'll mention - for bash.2-04 ~$ (I'm too tired to check but the bash is the same as the one returned from csh.cshrc. For the tcsh prompt I modified the csh.cshrc to change prompt to tcsh if the tcsh is users shell. These would not work consistantly when telneting to my own local host. Even to other hosts its inconsistant but very much inconsistant - mostly does not work on the local lhost. I thought that the /etc/csh.cshrc when I used bash was screwing things up so I experimented with setting the prompt there but it did not work consistantly. The underneath mechanics seem to want to set the prompt on a local login to bash-2.04 ~$. The best working combination I could get was to set the user shell to tcsh and modify the /etc/csh.cshrc to set the prompt to tcsh . That worked the best for a local login but would still sometimes fail. I could not find a simmilar bug after a number of searches. How reproducible: Sometimes Steps to Reproduce: 1. run bash shell 2. Keep /etc/csh.cshrc as usual 3. run script 4. ? I run the script as root but login with a non-priv user davidk, asdfghj but this does not matter. I get the same behavior regardless of the user that runs the script priv or non-priv. 5. -later, modify csh.cshrc to give a simple consistant prompt like tcsh . Better but still inconsistant. 6. I have not been able to do anything to make this consistant. Actual Results: I get timed out waiting for prompt. Expected Results: Should run the ls command - does inconsistantly Additional info: For Reproducibility - its very reproducable. I'm having this problem 4 linux 7.0 systems at work. We run our app and nothing else. When I run the script its the only thing running other than system processes. On my home linux system which is very clean I get the same results.
All the shell items mentioned above are misleading - sorry. I never knew about /etc/csh.cshrc and got confused. So that aside and the prompts running properly in bash or tcsh the inconsistancy still exists. If I run with Dump_log setup there are 3 things that happen. 1. user name goes to the remote - password: is not seen comming back. 2. user name goes to the remote - wassword: is sent back - the prompt is not sent. 3. Runs correctly. If I run the same script on solaris with Perl 5.005 it runs correctly all the time. If I run the same script on solaris to linux it runs correctly. If I run from linux to solaris it runs correctly. If I run from linux to another linux machine its inconsistant. If I run from linux to the same linux machine its inconsistant. The timeout happens in the sub waitfor in Telnet.pm
I think the problem is Linux not responding fast enough to requests. If I pad the Telnet.pm with sleeps between login/waitfor and password/waitfor the script performs well. The results are still under test but so far I have had a run of 100 times in a row where it did not hang and executed correctly. Solaris can handle this and linux should also. Again this happens between linux machines - either one machine accessing itself or one linux machine to another.
Linux box might be doing reverse-DNS lookups or ident-queries. If there are problems with either of these on the connecting box, it might take a while? Or do the waits happen after these have already been done?