Quoting MK <pub...@kubikcz.net>:

> Hello,
> 
> maybe you still recall about problem with ftpd memory allocation I
> posted 
> here few days before. Since then I tried to do more "research" and found
> 
> same issue on two different HW boxes both with OpenBSD 4.5 and OpenBSD
> 4.6.
> To summarize it, I found that built-in ftpd server takes too much memory
> 
> while clients are downloading files and this memory is not freed neither
> 
> when downloads are finished nor when I kill ftpd. What's more, top, ps,
> 
> vmstat does not show by which process is memory allocated. All I can see
> 
> during ftp downloads initiated by clients it's just decreasing free
> memory 
> and increasing allocated memory from top command output. After few
> minutes 
> of downloading I lost about 800MB real memory. Allocated memory shown by
> top 
> command is a part of real memory behind the "/". This should be
> something 
> like allocated memory which is not currently used if I'm not mistaken.
> 
> Although I'm not sure if this could be intentional behavior I have three
> 
> main questions:
> 
> 1. Is it normal that memory is not freed after I kill ftpd daemon?
> 2. Is it normal ftpd can take about 800MB of real memory while serving
> GET 
> requests? (only 1 client is able to consume that portion of memory)
> 3. Is it normal that this memory seems to be lost from the system? It's
> not 
> visible as allocated by some process.
> 
> Thank you for your help.
> MK 
> 
>  

I cannot reproduce here - artificial tests on a box running as a desktop, so
take the figures with a pinch of salt; but if there was an issue with the stock
ftpd I'd expect to see something?  i386 4.6 with errata patches.

# /usr/libexec/ftpd -D
# ftp localhost

Memory: Real: 272M/661M act/tot  Free: 1338M  Swap: 0K/251M used/tot

Get 459Mb file
1/2 way Memory: Real: 273M/667M act/tot  Free: 1332M  Swap: 0K/251M used/tot
Done    Memory: Real: 273M/659M act/tot  Free: 1340M  Swap: 0K/251M used/tot

150 Opening BINARY mode data connection for '32r2741.iso' (481689600 bytes).
100%
|*******************************************************************************************|
  459 MB    01:08
226 Transfer complete.
200 NOOP command successful.
481689600 bytes received in 68.57 seconds (6.70 MB/s)

Get it again ...

1/2 way Memory: Real: 273M/667M act/tot  Free: 1332M  Swap: 0K/251M used/tot
Done    Memory: Real: 273M/667M act/tot  Free: 1332M  Swap: 0K/251M used/tot

And again ...

70%     Memory: Real: 273M/659M act/tot  Free: 1340M  Swap: 0K/251M used/tot
Done    Memory: Real: 273M/663M act/tot  Free: 1336M  Swap: 0K/251M used/tot

And again ...

1/2 way Memory: Real: 273M/667M act/tot  Free: 1332M  Swap: 0K/251M used/tot
Done    Memory: Real: 273M/662M act/tot  Free: 1337M  Swap: 0K/251M used/tot

Fifth time, this time with 2 clients getting the same file ...

Before  Memory: Real: 275M/667M act/tot  Free: 1332M  Swap: 0K/251M used/tot
1/2 way Memory: Real: 274M/666M act/tot  Free: 1333M  Swap: 0K/251M used/tot
70%     Memory: Real: 274M/667M act/tot  Free: 1332M  Swap: 0K/251M used/tot
Done    Memory: Real: 273M/662M act/tot  Free: 1337M  Swap: 0K/251M used/tot

At the half-way mark ...

  PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND

23507 xxxxxxxx  -5    0  620K  972K sleep     biowait   0:09  0.93% ftpd
15892 root       2    0 1244K  848K sleep     netio     0:06  0.63% ftp
23158 xxxxxxxx   2    0 1236K  828K sleep     netio     0:00  0.49% ftp
23359 xxxxxxxx -14    0  620K  944K sleep     inode     0:00  0.44% ftpd

Quit both ftp clients ...

Memory: Real: 273M/662M act/tot  Free: 1337M  Swap: 0K/251M used/tot

# ps waux | grep ftpd
root      6424  0.0  0.0   568   836 ??  Is     3:49PM    0:00.00
/usr/libexec/ftpd -D
root      4008  0.0  0.0   444   804 p1  S+     4:04PM    0:00.00 grep ftpd

# kill 6424

# ps waux | grep ftpd
root     32390  0.0  0.0   484     4 p1  R+     4:05PM    0:00.00 grep ftpd 
(ksh)

Memory: Real: 271M/662M act/tot  Free: 1337M  Swap: 0K/251M used/tot

HTH.

Reply via email to