PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Networking » Net_FTP » Bug #1051

Ftp getRecursive hangs

Details

Submitted2004-03-22 08:57 UTC
Frommpk at dentline dot nl
Assignedtoby
StatusBogus
PackageNet_FTP
PHP Version4.3.2
OSLinux Mandrake 9.2
Roadmaps(Not assigned)

Comments

[2004-03-22 08:57 UTC] mpk at dentline dot nl

Description:
------------
I have a list of directories with a series of files in each that I want to retrieve. Automatic retrieval with $ftp->getRecursive() hangs after 3 directories. For a strange reason it cannot retrieve a file (that means it is created in the destination directory but it remains with 0 size). For all the subsequent directories I get this message "Warning: Invalid argument supplied for foreach() in /usr/lib/php/FTP.php on line 1467". It retrieves then no files though it creates if needed the directories. I have tested with all the versions from 1.2, 1.3b1, 1.3b2.

Reproduce code:
---------------
dump($ftp->cd('/www/praktijken'), 'FTP::cd()');
$dirs = $ftp->ls(null, NET_FTP_DIRS_ONLY);
for ($i=0;$i<count($dirs);$i++){
$dirnaam = $dirs[$i][name];
print $dirnaam;
if (!is_dir("/www/praktijken/$dirnaam")) {
umask(0);
mkdir ("/www/praktijken/$dirnaam", 0755);
}
$ftp->getRecursive("/www/praktijken/$dirnaam/" , "/www/praktijken/$dirnaam/", true, FTP_BINARY);
}

Expected result:
----------------
Retrieve all files in the corresponding directories

[2004-03-22 11:12 UTC] mpk at dentline dot nl

The server side: ProFTPd version 1.29 on Debian Linux 3.0
--enable-ftp on client side activated (also tested with same results with Mandrake 9.1 and PHP 4.3.1).

The list of directories is the following. By the third directory
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 Demo
drwxr-xr-x 2 dentline users 4096 Feb 27 11:11 acht
drwxr-xr-x 2 dentline users 4096 Feb 27 11:01 akmal
drwxr-xr-x 2 dentline users 356352 Mar 22 09:13 allessie
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 barendregt
drwxr-xr-x 2 dentline users 4096 Feb 27 11:23 bennekom
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 bernardo
drwxr-xr-x 2 dentline users 4096 Mar 18 11:38 bolhuis
drwxr-xr-x 2 dentline users 4096 Mar 19 08:17 demo
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo1
drwxr-xr-x 2 dentline users 8192 Mar 2 10:42 demo10
drwxr-xr-x 2 dentline users 4096 Feb 14 12:23 demo11
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo12
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo13
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo14
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo15
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo16
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo17
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo18
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo19
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo2
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo20
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo21
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo22
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo23
drwxr-xr-x 2 dentline users 4096 Feb 4 15:57 demo24
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo25
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo26
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo27
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo28
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo29
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo3
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo30
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo31
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo32
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo33
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo34
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo35
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo36
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo37
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo38
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo39
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo4
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo40
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo41
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo42
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo43
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo44
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo45
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo46
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo47
drwxr-xr-x 2 dentline users 4096 Feb 4 15:58 demo48
drwxr-xr-x 2 dentline users 4096 Feb 4 15:59 demo49
drwxr-xr-x 2 dentline users 4096 Feb 4 15:59 demo5
drwxr-xr-x 2 dentline users 4096 Feb 4 15:59 demo50
drwxr-xr-x 2 dentline users 4096 Feb 4 15:59 demo51
drwxr-xr-x 2 dentline users 4096 Feb 4 15:59 demo52
drwxr-xr-x 2 dentline users 4096 Feb 4 15:59 demo53
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo54
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo55
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo56
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo57
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo58
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo59
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo6
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo60
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo61
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo62
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo63
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo64
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo65
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo66
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo67
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo68
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo69
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo7
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo70
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo71
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo72
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo73
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo74
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo75
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo76
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo77
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo78
drwxr-xr-x 2 dentline users 4096 Mar 3 11:23 demo79
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo8
drwxr-xr-x 2 dentline users 4096 Mar 11 13:46 demo80
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo81
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo82
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo83
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo84
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo85
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo86
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo87
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo88
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo89
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo9
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo90
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo91
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo92
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo93
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo94
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo95
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo96
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 demo97
drwxr-xr-x 2 dentline users 45056 Jan 21 16:01 demo98
drwxr-xr-x 2 dentline users 4096 Feb 4 15:59 dentalcare
drwxr-xr-x 2 dentline users 4096 Mar 16 08:15 dewit
drwxr-xr-x 2 dentline users 40960 Mar 19 09:51 djamaludin
drwxr-xr-x 2 dentline users 4096 Feb 11 10:28 dongemond
drwxr-xr-x 2 dentline users 20480 Mar 22 10:35 eijsbouts
drwxr-xr-x 2 dentline users 4096 Feb 27 10:36 faessaert
drwxr-xr-x 2 dentline users 4096 Feb 27 09:22 flexdent
drwxr-xr-x 2 dentline users 4096 Feb 4 16:00 ftp
drwxr-xr-x 2 dentline users 4096 Feb 27 10:04 groothuis
drwxr-xr-x 2 dentline users 4096 Feb 27 08:57 gruter
drwxr-xr-x 2 dentline users 4096 Feb 27 11:44 hornman
drwxr-xr-x 2 dentline users 4096 Feb 27 10:48 houtsma
drwxr-xr-x 2 dentline users 4096 Feb 4 16:00 jarno
drwxr-xr-x 2 dentline users 4096 Feb 27 08:46 meeuwis
drwxr-xr-x 2 dentline users 4096 Feb 27 09:05 mensink
drwxr-xr-x 2 dentline users 4096 Jan 25 10:22 mpk
-rw-r--r-- 1 dentline users 67 Feb 4 15:52 null
drwxr-xr-x 2 dentline users 4096 Mar 21 22:21 oltmans
drwxr-xr-x 2 dentline users 49152 Mar 22 10:42 omnivor
drwxr-xr-x 2 dentline users 8192 Feb 14 13:58 parorotterdam
drwxr-xr-x 2 dentline users 4096 Feb 4 16:00 simplex
drwxr-xr-x 2 dentline users 16384 Mar 22 08:53 sms
drwxr-xr-x 2 dentline users 8192 Mar 18 14:30 sonneveld
drwxr-xr-x 2 dentline users 45056 Mar 22 10:42 tandheelkunst
drwxr-xr-x 2 dentline users 12288 Mar 22 09:40 tendens
drwxr-xr-x 2 dentline users 28672 Mar 22 10:28 teng
drwxr-xr-x 2 dentline users 4096 Jan 16 13:35 test
drwxr-xr-x 2 dentline users 16384 Mar 19 15:20 test_dev
drwxr-xr-x 2 dentline users 4096 Feb 17 10:58 topcuogli
drwxr-xr-x 2 dentline users 4096 Mar 16 17:35 vangelder
drwxr-xr-x 2 dentline users 28672 Mar 22 10:29 wasser
drwxr-xr-x 2 dentline users 4096 Feb 27 11:34 weststrate
drwxr-xr-x 2 dentline users 16384 Mar 22 10:36 wigchert
drwxr-xr-x 2 dentline users 4096 Feb 27 08:52 willemstraat

Up to the second directory it retrieves ok. It produces at the client side a directory list (second directory /www/praktijken/acht):
-rw-r--r-- 1 apache apache 1681 mrt 22 09:49 afspraaktypes20040226155821.xml
-rw-r--r-- 1 apache apache 1681 mrt 22 09:49 afspraaktypes20040226155901.xml
-rw-r--r-- 1 apache apache 1681 mrt 22 09:49 afspraaktypes20040227121056.xml
-rw-r--r-- 1 apache apache 271414 mrt 22 09:49 afspraken20040226155834000.xml
-rw-r--r-- 1 apache apache 98440 mrt 22 09:49 afspraken20040226155849001.xml
-rw-r--r-- 1 apache apache 439 mrt 22 09:49 afspraken20040226155854002.xml
-rw-r--r-- 1 apache apache 271414 mrt 22 09:49 afspraken20040226155914000.xml
-rw-r--r-- 1 apache apache 98440 mrt 22 09:49 afspraken20040226155928001.xml
-rw-r--r-- 1 apache apache 439 mrt 22 09:49 afspraken20040226155935002.xml
-rw-r--r-- 1 apache apache 273153 mrt 22 09:49 afspraken20040227121108000.xml
-rw-r--r-- 1 apache apache 97867 mrt 22 09:49 afspraken20040227121123001.xml
-rw-r--r-- 1 apache apache 3 mrt 22 09:49 bloklog.txt
-rw-r--r-- 1 apache apache 2493 mrt 22 09:49 importpraktijk20040226155821000.xml
-rw-r--r-- 1 apache apache 2493 mrt 22 09:49 importpraktijk20040226155901000.xml
-rw-r--r-- 1 apache apache 2493 mrt 22 09:49 importpraktijk20040227121055000.xml
-rw-r--r-- 1 apache apache 67 mrt 22 09:49 null

At the third, it hangs at the first file. So the produced result is (for /www/praktijken/akmal)

totaal 0
-rw-r--r-- 1 apache apache 0 mrt 22 09:49 afspraaktypes20040226160448.xml

Sometimes it can get up to the fourth directory. But about then it is over. After it hangs at a file, it follows a regular timeout from the ftp server within few minutes.

I cannot give a test account at the moment it is a production environment.

[2004-03-22 13:13 UTC] mpk at dentline dot nl

I just tested it. It looks like it has nothing to do with the problem. It stalls at a file and after X minutes it does a timeout. The problem is the stalling. This happens in a period of 10-20 seconds (the one it takes to retrieve some 20 <1k files). Is there any way to overcome the stalling? Or any other ideas? Thanks.