linux help: shell scripts are REALLY slow when networking is enabled

eLiu

Diamond Member
Jun 4, 2001
6,407
1
0
So I have a weird issue here.

When:
1) I'm connected wirelessly at school
2) I'm connected wirelessly at home
3) I'm connected wired-ly at home
(but NOT when I'm on a wired connection at school...)

shell scripts (e.g. .csh files) run REALLY slowly. It's roughly an order of magnitude difference. Why on earth is this happening? Looking at "top", I don't see any extra processes running when networking is disabled/enabled.

Binaries seem to run just fine. I haven't noticed anything else that is slower due to me being connected to the internet in some way. But scripts being slow is incredibly irritating b/c unless I want to wait an hour for my shit to compile (among other things), I have to disconnect from the net.

I tried googling around but for the most part I just run across people complaining about their connection speed sucking...

Any ideas?
-Eric

Edit: oops, left off a potentially useful detail... my network manager is:
NetworkManager Applet 0.7.0
I'm on Ubuntu 8.10, window manger is GNOME 2.24.1, shell is:
tcsh 6.14.00 (Astron) 2005-03-25 (x86_64-unknown-linux) options wide,nls,dl,al,kan,rh,nd,color,filec
 
Last edited:

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
I don't know csh very well, but look for an option to print out the lines that are beingexecuted as the script runs (-x in better shells). Figure out where it's hanging.
 

eLiu

Diamond Member
Jun 4, 2001
6,407
1
0
I don't know csh very well, but look for an option to print out the lines that are beingexecuted as the script runs (-x in better shells). Figure out where it's hanging.

Every line of the script runs slower. It happens in bash too. The scripts are pretty simple things... like a configure script to set up parameters for "make" (which involves "set", "echo", "if" and "while." Normally the script executes faster than the output can print to screen; when networking is on, I get to watch each line print ohsoslowly.

The make command is also slow. As is the script I use to run jobs (sets variables & calls functions in a while loop), and the script used to perform regression tests (sets variables, calls functions, does some string processing to compare outputs).
 

dinkumthinkum

Senior member
Jul 3, 2008
203
0
0
You could try stracing it to see if it spends time in system calls.

If binaries ran slowly I'd suggest it was some kind of problem with your network driver, but that is rather strange behavior.
 

uOpt

Golden Member
Oct 19, 2004
1,628
0
0
A possible explanation for slowness when networked is that some DNS lookup is happening. It fails right away when no network is available and does a real lookup out to the 'net otherwise.

Why every single csh line should be affected I don't know but an `strace -f csh myscript` will tell.
 

VinDSL

Diamond Member
Apr 11, 2006
4,869
1
81
www.lenon.com
[...]I'd suggest it was some kind of problem with your network driver[...]
Agreed!

I had a weird problem with Ubuntu/Mint wireless drivers on my EeePC.

Whenever there was any (wireless) network activity, my display would flicker like mad.

Initially, I thought my netbook was defective, but as it turned out, the native Ubu wireless driver was causing the problem. I switched to a non-free driver (MadWifi) and all was good.

Moral of the story: After this head-scratching experience, I would judge that wonky network drivers can cause any number of weird, seemingly dissociated problems.
 

eLiu

Diamond Member
Jun 4, 2001
6,407
1
0
A possible explanation for slowness when networked is that some DNS lookup is happening. It fails right away when no network is available and does a real lookup out to the 'net otherwise.

Why every single csh line should be affected I don't know but an `strace -f csh myscript` will tell.

Whoops, I totally forgot about this thread (went to a conference a few days after the OP). But am I fucking glad I found it again!

uOpt: thanks for the strace tip! There was nothing peculiar running and no one thing taking up epic amounts of time, what I did notice was a bunch of references to an afs folder that wasn't set up. They were carried over from when I used to on campus. I had some startup files that put references in my LD_LIBRARY_PATH to the school's MATLAB directory b/c I was once too lazy to set up BLAS/LAPACK/UMFPACK/etc for myself. (All the scripts I run have to do with configuring for make, make, configuring compilers, running dynamically linked execs, etc.)

So every time LD_LIBRARY_PATH was accessed (which is rather often), my guess is that the thing would have to wait for some kind of timeout.


Well, thanks for all the suggestions everyone, problem solved! :)