[horde] PHP 5.2, large SQL return sets = indefinite stall - apparently in PHP

James MacLean macleajb at ednet.ns.ca
Tue Jan 2 19:15:12 PST 2007


Hi Folks,

This was originally reported to the Turba list, but I believe it is in 
line with similar discussion here and have brought it over in hope of 
some suggestions or feedback.

We have been running IMP for quite some time and just started opening up 
the full power of Horde ;) . The problem I am reporting has been seen on 
multiple Intel systems (running 32 and 64bit), but the biggest engine 
showing this problem is :

. Linux 2.6.19
. x86_64
. 4 CPUs
. 8G RAM
. Apache 2.2.3
. php 5.2 and 5.2.1RC1 (5.1 actually seems to complete more often, just 
still slow where it gets stuck)
. php memory_limit 1024M (Just to be sure)

Address Book (turba) H3 (2.1.3)
Bookmarks (trean) 0.1-cvs
Calendar (kronolith)  H3 (2.1.4)
EDnet Web E-Mail (horde) 3.1.3
File Manager (gollem)  H3 (1.0.2)
Filters (ingo)  H3 (1.1.2)
Mail (imp) H3 (4.1.3)
Mobile Mail (mimp) H3 (1.0)
Notes (mnemo)  H3 (2.1.1)
Password (passwd)  H3 (3.0)
Tasks (nag) H3 (2.1.2)

We have seen this stalling in both sessions management via SQL/hordedb 
and using our large address book (150,000+ entries). What we have found 
is that php hangs sometimes for a short time, sometimes indefinitely. 
Turba's hanging occurs when doing a search returning a large result. The 
code that it stops in is turba/search.php line 54:

   if ((is_array($criteria) && count($criteria)) || !empty($val)) {
       if (($_SESSION['turba']['search_mode'] == 'basic' &&
            is_object($results = $driver->search(array($criteria => 
$val)))) ||
           ($_SESSION['turba']['search_mode'] == 'advanced' &&
            is_object($results = $driver->search($criteria)))) {

and it is in the returning of the search. We know from debug statements 
that turba/lib/Driver/sql.php completes fine (and fast), 
turba/lib/Driver.php completes (at least to the return statement). Then 
it appears to be waiting for this code to complete (specifically the 
search piece). Strace shows the httpd process doing no calls. This httpd 
is consuming 100% CPU.

When we mocked up some php code just to make a similar call through a 
class and test the result from the database, it was returning fast and 
fine. So outside of Horde we were not able to create this same affect.

Our current hack is to add "LIMIT 1000" to the address book calls and 
LIMIT 100 to horde calls without an AND statement.

Would any one have any suggestions as to how we can explain/fix what is 
happening?

thanks,
JES
--


More information about the horde mailing list