ID:               41370
 Updated by:       [EMAIL PROTECTED]
 Reported By:      paul at gracion dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Reproducible crash
 Operating System: Mac OS X 10.4.9
 PHP Version:      5.2.2
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2007-05-12 00:15:38] paul at gracion dot com

Description:
------------
Bad(?) PHP code causes non-response to web browser, minutes later 
(during subsequent hits to other php pages) an apache process crashes.

What code does: given an HTTP file upload, reads the temporary file
with 
fopen/fgets and writes to MySQL using PDO. fclose() was not called, 
workaround may to be to call fclose(). Reproducable by one user but not

by another.

(Mac OS X Client 10.4.9's bundled apache, php5.2.2 binary from http://
www.entropy.ch/software/macosx/php/ )

Reproduce code:
---------------
$gSQL = new PDO('mysql:unix_socket=/tmp/mysql.sock;dbname=xxxxx',
SQL_USER, SQL_PASS);
$gSQL-> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if (isset($_FILES['widgets']) && ($_FILES['widgets']['error'] ==
UPLOAD_ERR_OK)) {
        $fhndl = fopen($_FILES['widgets']['tmp_name'], 'r');
        $st = $gSQL->prepare('INSERT INTO widgets (wigitid, wigit, numUsers,
created) VALUES (?, ?, ?, NOW())');
        $i = 0;
        while (!feof($fhndl)) {
                if ($line = fgets($fhndl)) { // line is about 15 chars, file is 
5-10
lines.
                        $st->execute(array($_POST['serialid'], $line, 
$_POST['numUsers']));
                        $i += 1;
                        print "."; // progress shown in web browser
                }
        }  // should be fclose() here
        print "<p>$i widgets imported successfully.</p>";
} else {
                print "<p>Error {$_FILES['widgets']['error']} uploading widgets
file.</p>";
}                       

Expected result:
----------------
Browser displays "$N widgets imported successfully". httpd child
process 
doesn't crash (later).

Actual result:
--------------
Nothing returned to browser, which times out after about 3 minutes. 
Then, user hits some phpMyAdmin 2.9.2 pages. On one of the hits, an 
httpd child crashes (the user hitting phpMyAdmin sees nothing wrong). 
got 3 different backtraces:

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000014

Thread 0 Crashed:
0   libphp5.so  0x023a6cf7 zend_mm_remove_from_free_list + 33
1   libphp5.so  0x023a7cc4 _zend_mm_free_int + 551
2   libphp5.so  0x023a86b6 _efree + 63
3   libphp5.so  0x023d12f2 zend_hash_destroy + 205
4   libphp5.so  0x023c4701 _zval_dtor_func + 153
5   libphp5.so  0x023b7181 _zval_dtor + 28
6   libphp5.so  0x023b73be _zval_ptr_dtor + 51
7   libphp5.so  0x0237242e php_request_shutdown + 534
8   libphp5.so  0x0243701f apache_php_module_main + 229
9   libphp5.so  0x02438077 send_php + 707
10  libphp5.so  0x024380d8 send_parsed_php + 39
11  httpd       0x00005861 ap_invoke_handler + 182
12  httpd       0x000192d1 process_request_internal + 817
13  httpd       0x000199c4 ap_process_request + 58
14  httpd       0x000101e3 child_main + 1822
15  httpd       0x00010742 make_child + 351
16  httpd       0x0001192c standalone_main + 4434
17  httpd       0x0001253c main + 2200
18  httpd       0x000017e6 _start + 228
19  httpd       0x00001701 start + 41

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000008  ebx: 0x023a6ce2  ecx: 0x0000e4d0  edx: 0x00000031
  edi: 0x01838b64  esi: 0x00000017  ebp: 0xbffff1e8  esp: 0xbffff1c0
   ss: 0x0000001f  efl: 0x00010286  eip: 0x023a6cf7   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037

---
Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x6f696365

Thread 0 Crashed:
0   libphp5.so  0x023d0068 _zend_hash_add_or_update + 56
1   libphp5.so  0x023808bf zend_symtable_update + 410
2   libphp5.so  0x023805c6 php_register_variable_ex + 1299
3   libphp5.so  0x0209660e php_sapi_filter + 809
4   libphp5.so  0x02380fab php_default_treat_data + 867
5   libphp5.so  0x02381e07 php_hash_environment + 853
6   libphp5.so  0x02371f1f php_request_startup + 523
7   libphp5.so  0x02436f55 apache_php_module_main + 27
8   libphp5.so  0x02438077 send_php + 707
9   libphp5.so  0x024380d8 send_parsed_php + 39
10  httpd       0x00005861 ap_invoke_handler + 182
11  httpd       0x000192d1 process_request_internal + 817
12  httpd       0x000199c4 ap_process_request + 58
13  httpd       0x000101e3 child_main + 1822
14  httpd       0x00010742 make_child + 351
15  httpd       0x0001192c standalone_main + 4434
16  httpd       0x0001253c main + 2200
17  httpd       0x000017e6 _start + 228
18  httpd       0x00001701 start + 41

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x6f696361  ebx: 0x023d003e  ecx: 0x0059778b  edx: 0x0b8868eb
  edi: 0x005c775d  esi: 0x00000017  ebp: 0xbffff088  esp: 0xbffff030
   ss: 0x0000001f  efl: 0x00010286  eip: 0x023d0068   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037

---
Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000005

Thread 0 Crashed:
0   libphp5.so  0x023d0080 _zend_hash_add_or_update + 80 (was +56 
above, otherwise same trace)
1   libphp5.so  0x023808bf zend_symtable_update + 410
2   libphp5.so  0x023805c6 php_register_variable_ex + 1299
3   libphp5.so  0x0209660e php_sapi_filter + 809
4   libphp5.so  0x02380fab php_default_treat_data + 867
5   libphp5.so  0x02381e07 php_hash_environment + 853
6   libphp5.so  0x02371f1f php_request_startup + 523
7   libphp5.so  0x02436f55 apache_php_module_main + 27
8   libphp5.so  0x02438077 send_php + 707
9   libphp5.so  0x024380d8 send_parsed_php + 39
10  httpd       0x00005861 ap_invoke_handler + 182
11  httpd       0x000192d1 process_request_internal + 817
12  httpd       0x000199c4 ap_process_request + 58
13  httpd       0x000101e3 child_main + 1822
14  httpd       0x00010742 make_child + 351
15  httpd       0x0001192c standalone_main + 4434
16  httpd       0x0001253c main + 2200
17  httpd       0x000017e6 _start + 228
18  httpd       0x00001701 start + 41

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000005  ebx: 0x023d003e  ecx: 0x1070cd46  edx: 0x00000005
  edi: 0x005c7781  esi: 0x00000017  ebp: 0xbffff088  esp: 0xbffff030
   ss: 0x0000001f  efl: 0x00010246  eip: 0x023d0080   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41370&edit=1

Reply via email to