Code Monkey home page Code Monkey logo

Comments (9)

m6w6 avatar m6w6 commented on June 14, 2024

Thank you for the report!

Quite crazy preconditions :S Do you have the valgrind log at hand?

from ext-http.

afflerbach avatar afflerbach commented on June 14, 2024
$ USE_ZEND_ALLOC=0 ZEND_DONT_UNLOAD_MODULES=1 valgrind --tool=memcheck --leak-check=full --show-reachable=yes --show-leak-kinds=all --track-origins=yes --log-file=/tmp/valgrind.txt php /tmp/test.php

valgrind.txt

from ext-http.

m6w6 avatar m6w6 commented on June 14, 2024

A wild guess would be replacing php_http_header_parser.c:172 with

while (colon < (buffer->data + buffer->used) && PHP_HTTP_IS_CTYPE(space, *++colon) && *colon != '\n' && *colon != '\r');

...but that might only be one problem...

Might be easier to share the URL with me at [email protected]

Thanks!

from ext-http.

afflerbach avatar afflerbach commented on June 14, 2024

A wild guess would be replacing php_http_header_parser.c:172 with

Does not seem to help. URL sent.

from ext-http.

m6w6 avatar m6w6 commented on June 14, 2024

This is a really insanely fragile case.

from ext-http.

m6w6 avatar m6w6 commented on June 14, 2024

Funny fact, it does not always crash for me. /o\

Also, here's a backtrace without zend_alloc:

(gdb) bt
#0  0x00007ffff55927e9 in malloc_consolidate () from /usr/lib/libc.so.6
#1  0x00007ffff5593390 in _int_free () from /usr/lib/libc.so.6
#2  0x00000000008d84b6 in _efree (ptr=0x15198b0, __zend_filename=0xe75110 "/home/mike/src/php-master/Zend/zend_hash.c", __zend_lineno=1308, 
    __zend_orig_filename=0x0, __zend_orig_lineno=0) at /home/mike/src/php-master/Zend/zend_alloc.c:2423
#3  0x000000000092ee98 in zend_hash_destroy (ht=0x14bda30) at /home/mike/src/php-master/Zend/zend_hash.c:1308
#4  0x000000000080b81f in php_http_message_dtor (message=0x14bda10) at /home/mike/src/php-master/ext/http/src/php_http_message.c:485
#5  0x000000000080cc30 in php_http_message_object_free (object=0x151c678) at /home/mike/src/php-master/ext/http/src/php_http_message.c:867
#6  0x000000000096dde0 in zend_objects_store_del (object=0x151c678) at /home/mike/src/php-master/Zend/zend_objects_API.c:178
#7  0x00000000009134b2 in _zval_dtor_func (p=0x151c678, __zend_filename=0xe7ade8 "/home/mike/src/php-master/Zend/zend_execute.c", __zend_lineno=2101)
    at /home/mike/src/php-master/Zend/zend_variables.c:56
#8  0x000000000097d8b7 in i_free_compiled_variables (execute_data=0x7ffff7f1f1c0) at /home/mike/src/php-master/Zend/zend_execute.c:2101
#9  0x00000000009803cf in zend_leave_helper_SPEC () at /home/mike/src/php-master/Zend/zend_vm_execute.h:481
#10 0x000000000098818b in ZEND_RETURN_SPEC_CONST_HANDLER () at /home/mike/src/php-master/Zend/zend_vm_execute.h:2858
#11 0x0000000000980182 in execute_ex (ex=0x7ffff7f1f040) at /home/mike/src/php-master/Zend/zend_vm_execute.h:426
#12 0x0000000000980383 in zend_execute (op_array=0x13da330, return_value=0x0) at /home/mike/src/php-master/Zend/zend_vm_execute.h:471
#13 0x00000000009186ff in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/mike/src/php-master/Zend/zend.c:1427
#14 0x000000000085a0ec in php_execute_script (primary_file=0x7fffffffde90) at /home/mike/src/php-master/main/main.c:2492
#15 0x0000000000a06d52 in do_cli (argc=2, argv=0x11dd300) at /home/mike/src/php-master/sapi/cli/php_cli.c:982
#16 0x0000000000a07fec in main (argc=2, argv=0x11dd300) at /home/mike/src/php-master/sapi/cli/php_cli.c:1352

Another one, deferred to shutdown:

(gdb) bt
#0  0x00007ffff55927e9 in malloc_consolidate () from /usr/lib/libc.so.6
#1  0x00007ffff5593390 in _int_free () from /usr/lib/libc.so.6
#2  0x00000000008d8851 in _efree (ptr=0x13dcb00, __zend_filename=0xe75630 "/home/mike/src/php-master/Zend/zend_hash.c", __zend_lineno=1359, 
    __zend_orig_filename=0x0, __zend_orig_lineno=0) at /home/mike/src/php-master/Zend/zend_alloc.c:2423
#3  0x000000000092f478 in zend_array_destroy (ht=0x13dcac0) at /home/mike/src/php-master/Zend/zend_hash.c:1359
#4  0x00000000009137f7 in _zval_dtor_func (p=0x13dcac0, __zend_filename=0xe72328 "/home/mike/src/php-master/Zend/zend_opcode.c", __zend_lineno=399)
    at /home/mike/src/php-master/Zend/zend_variables.c:43
#5  0x00000000009026eb in _zval_ptr_dtor_nogc (zval_ptr=0x13dc9c0, __zend_filename=0xe72328 "/home/mike/src/php-master/Zend/zend_opcode.c", 
    __zend_lineno=399) at /home/mike/src/php-master/Zend/zend_variables.h:40
#6  0x0000000000903aae in destroy_op_array (op_array=0x13bb9c8) at /home/mike/src/php-master/Zend/zend_opcode.c:399
#7  0x0000000000902ae9 in zend_function_dtor (zv=0x7fffffffb860) at /home/mike/src/php-master/Zend/zend_opcode.c:124
#8  0x000000000092e708 in _zend_hash_del_el_ex (ht=0x11df010, idx=905, p=0x137ec30, prev=0x0) at /home/mike/src/php-master/Zend/zend_hash.c:1026
#9  0x000000000092e7d4 in _zend_hash_del_el (ht=0x11df010, idx=905, p=0x137ec30) at /home/mike/src/php-master/Zend/zend_hash.c:1050
#10 0x0000000000930084 in zend_hash_reverse_apply (ht=0x11df010, apply_func=0x8fa717 <clean_non_persistent_function>)
    at /home/mike/src/php-master/Zend/zend_hash.c:1628
#11 0x00000000008fc2fe in shutdown_executor () at /home/mike/src/php-master/Zend/zend_execute_API.c:367
#12 0x0000000000916d8c in zend_deactivate () at /home/mike/src/php-master/Zend/zend.c:967
#13 0x0000000000858935 in php_request_shutdown (dummy=0x0) at /home/mike/src/php-master/main/main.c:1831
#14 0x0000000000a07b6c in do_cli (argc=2, argv=0x11de300) at /home/mike/src/php-master/sapi/cli/php_cli.c:1149
#15 0x0000000000a08387 in main (argc=2, argv=0x11de300) at /home/mike/src/php-master/sapi/cli/php_cli.c:1352

from ext-http.

afflerbach avatar afflerbach commented on June 14, 2024

Thank you, that works better, but only a little. After a couple of successful runs the above script starts crashing again. valgrind still reports tons of errors.

I managed to create a much simpler test case, where valgrind already finds 3 problems (USE_ZEND_ALLOC=0 valgrind php /tmp/test.php, see attached log):

<?php
$request = new http\Client\Request('GET', 'http://localhost/bug.php');
$client = new http\Client();
$client->enqueue($request);
$client->send();

where bug.php is

<?php
header('Connection: Keep-Alive');
header('Content-Encoding: gzip');
print(gzencode('Hello'));

Is there anything I could help with?

from ext-http.

afflerbach avatar afflerbach commented on June 14, 2024

Thanks, seems to be more robust now.

from ext-http.

m6w6 avatar m6w6 commented on June 14, 2024

The problem with the tons of valgrind errors is, that they usually stem from intentionally uninitialized values from the ssl library... It's quite hard to wade through these to find the real issue.

Anyway, thanks a lot for the continued feedback!

from ext-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.