Investigations into ACCVIO when using Ilohamail under VMS --------------------------------------------------------- Rene Mendoza 23-FEB-2005 First a warning that I am no PHP expert. I just started playing with PHP and have only been using WASD for a few months, so I am a complete newbie with PHP and WASD but I have been doing programming for nearly 2 decades. Tested under VMS 7.3-2, with latest critical patches as of about 20-Jan-2005, Multinet 5.0, and WASD 9.02 with 1.2-1 PHP from HP. I followed the instructions on the WASD server page for installing Ilohamail. During the initial test I immediately noticed the ACCVIOs happening as explained on the WASD Ilohamail installation page. I was able to trace down where the ACCVIOs in Ilohamail were occurring through the liberal use of echo();flush(); statements. In this case it is caused by a call to the PHP file() function in the read() function in Ilohamail's data_manager.fs.inc file. It appears that the most likely time that the ACCVIO is likely to happen is when a zero length file is first accessed. It will always occur when you reduce a file to zero length and then immediately access it again. The one consistently reproducible process for causing an ACCVIO was to start with an empty contacts page, add a contact, then delete the one and only contact. The source of the original read() is reproduced here. --------begin function read(){ $filePath = $this->path; $this->data = false; $fp = fopen($filePath, "a"); //force create file if ($fp) fclose($fp); $lines = file($filePath); if (is_array($lines)){ $i=1; while ( list($key, $line) = each ($lines) ){ $a = explode(",", chop($line)); while ( list($k2, $data) = each($a) ){ list($type, $string) = explode(":", $da` if ($type!="id") $string = base64_decod` //$string = base64_decode($string); $this->data[$i][$type] = $string; } $this->data[$i]["id"] = $i; $i++; } }else{ $this->error.= "Failed to read from: $filePath.\n"; $this->data = array(); } return $this->data; } ---------end This is my modified version of the read() changes highlighted with "|". ---------begin function read(){ $filePath = $this->path; $this->data = false; | if (file_exists($filePath) ) { | clearstatcache(); | if (filesize($filePath) > 0 ) { | $lines = file($filePath); | } | else { | $lines = ""; | } | } | else { | $fp = fopen($filePath, "a"); //force create | if ($fp) fclose($fp); | $lines = ""; | } if (is_array($lines)){ $i=1; while ( list($key, $line) = each ($lines) ){ $a = explode(",", chop($line)); while ( list($k2, $data) = each($a) ){ list($type, $string) = explode(":", $da` if ($type!="id") $string = base64_decod` //$string = base64_decode($string); $this->data[$i][$type] = $string; } $this->data[$i]["id"] = $i; $i++; } }else{ $this->error.= "Failed to read from: $filePath.\n"; $this->data = array(); } return $this->data; } --------end The change I made was to check if the file exists and if it does only read it with file() if its length is greater than zero. clearstatcache() is called prior to checking the size so that the correct file size is returned. I am uncertain if my handling of $lines is correct in this case and its affect on the rest of the processing, although it appears to behave as you would expect it to. After making this change the ACCVIOs that I could reproduce consistently have stopped. I can't say that it will stop all ACCVIOs though. One final note, the ACCVIO output will be output immediately, so if the PHP script has done some output but it hasn't been flushed, you will have the ACCVIO output prior to the unflushed PHP output. This was a little confusing at first and made it seem as if the ACCVIO was occurring at a different point than it was. [Note by Mark Daniel: When using PHPWASD 1.3.0 or later it is possible to define a system-level logical name PHPWASD$WATCH_REMOTE_ADDR to the IP address string of the accessing client and 'watch' the PHP-engine/WASD interactions. This can provide a better handle on exactly when such an ACCVIO or other issue is occuring, as well as general insights into script behaviour. See the READMORE.HTML in the [SRC.PHP] directory.]