Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Corruption on XDebug Session #12927

Closed
tugrul opened this issue Jun 26, 2017 · 9 comments
Closed

Memory Corruption on XDebug Session #12927

tugrul opened this issue Jun 26, 2017 · 9 comments
Assignees
Labels
bug A bug report stale Stale issue - automatically closed status: unverified Unverified
Milestone

Comments

@tugrul
Copy link
Contributor

tugrul commented Jun 26, 2017

Expected and Actual Behavior

First request does not have a problem. Following request have strange memory behavior when
xdebug session active. Sometimes trying to allocate annoying size of memory, sometimes segfaulting. This behavior is changing on restart php-fpm.

Please provide an email address to share coredump.

Backtrace

#0  zend_hash_find_bucket (ht=<optimized out>, ht=<optimized out>, key=0x7fb37a28f668) at /usr/src/builddir/Zend/zend_hash.c:496
#1  _zend_hash_add_or_update_i (flag=1, pData=0x7ffe23825e90, key=0x7fb37a28f668, ht=0x7fb36e006e00) at /usr/src/builddir/Zend/zend_hash.c:568
#2  _zend_hash_str_update (ht=ht@entry=0x7fb36e006e00, str=str@entry=0x7fb3747bbcc2 "Authorization", len=<optimized out>, pData=pData@entry=0x7ffe23825e90)
    at /usr/src/builddir/Zend/zend_hash.c:667
#3  0x00007fb3747aecc5 in add_arg_for_req (ht=ht@entry=0x7fb36e006e00, arg=arg@entry=0x7fb3747bbcc2 "Authorization",
    val=val@entry=0x7fb37a27b480 "OAuth oauth_consumer_key=\"N340SdOXJnDgDpOiUwMCyw\",oauth_signature_method=\"HMAC-SHA1\",oauth_nonce=\"294928105950ff23da9160.19922039\",oauth_timestamp=\"1498480419\",oauth_version=\"1.0\",oauth_token=\"4282642"...) at /tmp/pear/temp/oauth/oauth.c:699
#4  0x00007fb3747b494b in oauth_add_signature_header (request_headers=request_headers@entry=0x7fb36e006e00, oauth_args=oauth_args@entry=0x7fb37a2973f0, header=header@entry=0x0)
    at /tmp/pear/temp/oauth/oauth.c:741
#5  0x00007fb3747b68ec in oauth_fetch (soo=0x7fb37a290000, url=<optimized out>, method=<optimized out>, request_params=<optimized out>, request_headers=<optimized out>, init_oauth_args=0x0,
    fetch_flags=9) at /tmp/pear/temp/oauth/oauth.c:1562
#6  0x00007fb3747b7d9b in zim_oauth_fetch (execute_data=0x7fb37a28f688, return_value=0x5) at /tmp/pear/temp/oauth/oauth.c:2375
#7  0x00007fb379a99745 in xdebug_execute_internal (current_execute_data=0x7fb37a2136b0, return_value=0x7fb37a213690) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:2147
#8  0x00005628e70a67d0 in ZEND_DO_FCALL_SPEC_HANDLER () at /usr/src/builddir/Zend/zend_vm_execute.h:844
#9  0x00005628e706165b in execute_ex (ex=<optimized out>) at /usr/src/builddir/Zend/zend_vm_execute.h:414
#10 0x00007fb379a98c16 in xdebug_execute_ex (execute_data=0x7fb37a2135f0) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:1995
#11 0x00005628e70a690d in ZEND_DO_FCALL_SPEC_HANDLER () at /usr/src/builddir/Zend/zend_vm_execute.h:800
#12 0x00005628e706165b in execute_ex (ex=<optimized out>) at /usr/src/builddir/Zend/zend_vm_execute.h:414
#13 0x00007fb379a98c16 in xdebug_execute_ex (execute_data=0x7fb37a213550) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:1995
#14 0x00005628e70a690d in ZEND_DO_FCALL_SPEC_HANDLER () at /usr/src/builddir/Zend/zend_vm_execute.h:800
#15 0x00005628e706165b in execute_ex (ex=<optimized out>) at /usr/src/builddir/Zend/zend_vm_execute.h:414
#16 0x00007fb379a98c16 in xdebug_execute_ex (execute_data=0x7fb37a213490) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:1995
#17 0x00005628e70a690d in ZEND_DO_FCALL_SPEC_HANDLER () at /usr/src/builddir/Zend/zend_vm_execute.h:800
#18 0x00005628e706165b in execute_ex (ex=<optimized out>) at /usr/src/builddir/Zend/zend_vm_execute.h:414
#19 0x00007fb379a98c16 in xdebug_execute_ex (execute_data=0x7fb37a2133f0) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:1995
#20 0x00005628e70a690d in ZEND_DO_FCALL_SPEC_HANDLER () at /usr/src/builddir/Zend/zend_vm_execute.h:800
#21 0x00005628e706165b in execute_ex (ex=<optimized out>) at /usr/src/builddir/Zend/zend_vm_execute.h:414
#22 0x00007fb379a98c16 in xdebug_execute_ex (execute_data=0x7fb37a213300) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:1995
#23 0x00005628e7011a95 in zend_call_function (fci=0x7ffe238267a0, fci_cache=0x7ffe23826770) at /usr/src/builddir/Zend/zend_execute_API.c:867
#24 0x00007fb3717816ce in zephir_call_user_func_array_noex () from /usr/lib/php/20151012/phalcon.so
#25 0x00007fb37185b933 in zim_Phalcon_Dispatcher_callActionMethod () from /usr/lib/php/20151012/phalcon.so
#26 0x00007fb379a99745 in xdebug_execute_internal (current_execute_data=0x7fb37a213270, return_value=0x7ffe238270b0) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:2147
#27 0x00007fb3717944d6 in zephir_call_user_function () from /usr/lib/php/20151012/phalcon.so
#28 0x00007fb37179492f in zephir_call_class_method_aparams () from /usr/lib/php/20151012/phalcon.so
#29 0x00007fb371a70815 in zim_Phalcon_Dispatcher__dispatch () from /usr/lib/php/20151012/phalcon.so
#30 0x00007fb379a99745 in xdebug_execute_internal (current_execute_data=0x7fb37a213210, return_value=0x7ffe23827480) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:2147
#31 0x00007fb3717944d6 in zephir_call_user_function () from /usr/lib/php/20151012/phalcon.so
#32 0x00007fb37179492f in zephir_call_class_method_aparams () from /usr/lib/php/20151012/phalcon.so
#33 0x00007fb3718cefc3 in zim_Phalcon_Dispatcher_dispatch () from /usr/lib/php/20151012/phalcon.so
#34 0x00007fb379a99745 in xdebug_execute_internal (current_execute_data=0x7fb37a2131b0, return_value=0x7ffe238278e0) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:2147
#35 0x00007fb3717944d6 in zephir_call_user_function () from /usr/lib/php/20151012/phalcon.so
#36 0x00007fb37179492f in zephir_call_class_method_aparams () from /usr/lib/php/20151012/phalcon.so
#37 0x00007fb371a4ef0c in zim_Phalcon_Mvc_Application_handle () from /usr/lib/php/20151012/phalcon.so
#38 0x00007fb379a99745 in xdebug_execute_internal (current_execute_data=0x7fb37a213140, return_value=0x7fb37a213100) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:2147
#39 0x00005628e70a67d0 in ZEND_DO_FCALL_SPEC_HANDLER () at /usr/src/builddir/Zend/zend_vm_execute.h:844
#40 0x00005628e706165b in execute_ex (ex=<optimized out>) at /usr/src/builddir/Zend/zend_vm_execute.h:414
#41 0x00007fb379a98c16 in xdebug_execute_ex (execute_data=0x7fb37a213030) at /usr/src/builddir/xdebug-2.5.1/xdebug.c:1995
#42 0x00005628e70b6687 in zend_execute (op_array=op_array@entry=0x7fb37a274000, return_value=return_value@entry=0x0) at /usr/src/builddir/Zend/zend_vm_execute.h:458
#43 0x00005628e7021363 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/builddir/Zend/zend.c:1443
#44 0x00005628e6fc0620 in php_execute_script (primary_file=0x7ffe2382a310) at /usr/src/builddir/main/main.c:2492
#45 0x00005628e6ea5c35 in main (argc=-383269792, argv=0x5628e927c43a) at /usr/src/builddir/sapi/fpm/fpm/fpm_main.c:1967

Details

  • Phalcon version: 3.x.x (all of the version 3)
  • PHP Version: 7.0.20-1~dotdeb+8.1
  • Operating System: Debian GNU/Linux 8.8 (jessie)
  • Installation type: Compiling from source
  • Zephir version (if any): 0.9.6a-dev-aef205594b
  • Xdebug version 2.5.1
  • Server: Nginx and php-fpm
@sergeyklay sergeyklay added Need information need script to reproduce Script is required to reproduce the issue labels Jun 26, 2017
@sergeyklay
Copy link
Contributor

Zephir version (if any): 0.9.6a-dev-aef205594b

Could you please try latest Phalcon? And without script to reproduce, web server config sample we can't deal what happens.

@tugrul
Copy link
Contributor Author

tugrul commented Jun 26, 2017

@sergeyklay same problem on latest Phalcon.

I pushed a branch to my invo project for to reproduce issue: https://github.com/tugrul/invo/commit/e72885f3a7e4dd4fc4adc573f0e327579aadcc63

Edit: You have to enter your Twitter App settings on service config.

protected function initSharedTwitter()
    {
        // https://apps.twitter.com/

        $twitter = new \Twitter\OAuth([
            'key' => '...',
            'secret' => '...'
        ]);

        $twitter->setDI($this);

        return $twitter;
    }

@sergeyklay
Copy link
Contributor

Just to you know zephir-lang/zephir@0.9.6...0.9.9

@sergeyklay
Copy link
Contributor

@tugrul Is problem appear with Zephir 0.9.9 ?

@tugrul
Copy link
Contributor Author

tugrul commented Jul 18, 2017

@sergeyklay nothing changed with Zephir 0.9.9

php --ri phalcon

phalcon


Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 3.2.1
Build Date => Jul 18 2017 12:06:12
Powered by Zephir => Version 0.9.9-868cb1f92b

@sergeyklay sergeyklay self-assigned this Jul 18, 2017
@sergeyklay sergeyklay added Not verified and removed Need information need script to reproduce Script is required to reproduce the issue labels Jul 18, 2017
@sergeyklay sergeyklay added this to the unplanned milestone Jul 18, 2017
@Jurigag
Copy link
Contributor

Jurigag commented Jul 18, 2017

Well i use phalcon 3.0.0, xdebug and php 7.0.13 and no problem at all.

@tugrul
Copy link
Contributor Author

tugrul commented Jul 20, 2017

@sergeyklay and @Jurigag

Note: No need to start xdebug session.

I built docker image.

First run the docker container.

you@yourmachine:~$ sudo docker run -p 8686:80 -t -i tugrul/debian:phalcon bash

Start nginx and php-fpm daemons in the container.

root@container:/# /etc/init.d/nginx start
root@container:/# /etc/init.d/php7.0-fpm start

Visit following address in your web browser and login with any twitter account:

http://localhost:8686/auth/login

Your browser is going to redirect to http://localhost:8686/auth/callback and you will see the access token informations your twitter account.

Visit again the previous login url

http://localhost:8686/auth/login

Your browser is going to redirect to http://localhost:8686/auth/callback again and you are going to expect bad gateway error.

@tugrul
Copy link
Contributor Author

tugrul commented Nov 12, 2017

I tried 3.2.4 and still have this problem. There is no relation width xdebug extension. Problem occurs even xdebug extension is disabled.

@stale
Copy link

stale bot commented Apr 16, 2018

Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues

@stale stale bot added the stale Stale issue - automatically closed label Apr 16, 2018
@niden niden added bug A bug report status: unverified Unverified and removed not verified labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report stale Stale issue - automatically closed status: unverified Unverified
Projects
None yet
Development

No branches or pull requests

4 participants