-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] v1.3.0 ::findFirst() stopped working as a result of a recent commit #2118
Comments
This error is because it can't obtain the model's source from the |
How do you explain that it is working with the previous commit and stops working after the one I have referenced? |
@sjinks How see? |
@temuri416 are you sure about 7e54b69? It is totally unrelated to the database / MVC stuff. |
Yes, I am quite positive. I was surprised myself. I was compiling from ext/ folder. Can I re-test it some other way? |
Are you able to reproduce it under CLI? |
yea that's a big question. I have a feeling that it is somehow related to Session. Let me check a few things... |
yep. CLI is fine, HTTP is crashing each time. I'm gonna move things a bit now. |
Could there be some sort of screw-up in DB metadata being cached in session object? |
Possibly. |
Can this be reproduced with php -S 127.0.0.1:9000 ? |
it's really difficult, as I need to have a Google OAuth2 user in the session to reach that page. I am going to diagnose it further. In the meantime, you may recall my problem with sessions being lost when an Exception is caught by IDE debugger.. that issue is back, is there a chance you could look at it? |
You can use smth like
This will make PHP listen all interfaces. |
hm, never done that before. let me see. |
php -S 0.0.0.0:9000 |
Isn't php-fpm on 9000? |
Well, please use any free port then :-) |
If you are able to reproduce the bug then please run php under valgrind: ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind php -S 0.0.0.0:9001 |
This is crazy. I have two very similar models: This code works fine: $param = [
'bind' => [
62,
1
],
'conditions' => '[id] = ?0 AND [record_status] = ?1',
];
$o = Member::findFirst($param); And this one crashes: $param = [
'bind' => [
102,
1
],
'conditions' => '[id] = ?0 AND [record_status] = ?1',
];
$o = Account::findFirst($param);
WTF?!! |
Please try running php under valgrind, this will tell us if there are any invalid reads/writes. |
I am not sure how to set up I can set up join.me session if you have time to work on this. |
Just create a file <?php
if (isset($_SERVER['PATH_INFO'])) {
$_GET['_url'] = $_SERVER['PATH_INFO'];
require 'index.php';
}
else {
return false;
}
?> and place it where your Then launch PHP like this: php -S 0.0.0.0:9001 router.php |
alright, I got it set up. The valgrind output is immense. How do I redirect it to a file? |
ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind php -S 0.0.0.0:9001 router.php 2>log.txt |
80kb. should I paste or email? |
pastebin is OK |
You will see a lot of "dbg-php-5.5.so" there. I have just disabled DBG module, but it did not help it. I can also send you valgrind with DBG off. |
yes, please |
With DBG disabled, are you able to reproduce the bug? |
I guess you use |
|
Invalid read of size 1 in Does Valgrind show anything when the script crashes (with DBG off)? |
If I'm not redirecting error output, what I see is this (DBG off): public# ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind php -S 0.0.0.0:9009 index.php
==2115== Memcheck, a memory error detector
==2115== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2115== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2115== Command: php -S 0.0.0.0:9009 index.php
==2115==
[Mon Mar 3 02:40:55 2014] PHP Deprecated: Comments starting with '#' are deprecated in /etc/php/php.ini on line 1966 in Unknown on line 0
PHP 5.5.1 Development Server started at Mon Mar 3 02:40:56 2014
Listening on http://0.0.0.0:9009
Document root is /var/web/nginx/html/krfs/public
Press Ctrl-C to quit.
==2115== Invalid read of size 1
==2115== at 0x73BC67: zif_strtr (string.c:2828)
==2115== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115== by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2115== by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2115== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115== by 0xFA772D0: phalcon_internal_require (require.c:103)
==2115== by 0xFA774E8: phalcon_require (require.c:144)
==2115== by 0xFB86361: zim_Phalcon_Mvc_View_Engine_Php_render (php.c:107)
==2115== Address 0x157f8d4d is 3 bytes before a block of size 7 alloc'd
==2115== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2115== by 0x7453FE: php_raw_url_encode (url.c:606)
==2115== by 0x745514: zif_rawurlencode (url.c:645)
==2115== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115== by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2115== by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2115== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115== by 0xFA772D0: phalcon_internal_require (require.c:103)
==2115== |
However, in that situation ::findFirst() does not crash. |
As far as I understand, it crashes only without valgrind? |
I'm going to re-test combinations now to give your a precise answer. However, if we leave model loading alone - is that |
Invalid reads are usually not dangerous but invalid writes are. |
Now, the interesting part.
That absolutely proves that the bug has something to do with Session object AND that the commit that I indicated IS indeed the culprit. |
That also means that I cannot give you good valgrind debug data, unless I get I am now going to try your suggestion with router.php. |
==2210== Memcheck, a memory error detector
==2210== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2210== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2210== Command: php -S 0.0.0.0:9009 router.php
==2210==
[Mon Mar 3 03:28:05 2014] PHP Deprecated: Comments starting with '#' are deprecated in /etc/php/php.ini on line 1966 in Unknown on line 0
==2210==
==2210== HEAP SUMMARY:
==2210== in use at exit: 20,247 bytes in 72 blocks
==2210== total heap usage: 213,136 allocs, 213,064 frees, 35,455,911 bytes allocated
==2210==
==2210== LEAK SUMMARY:
==2210== definitely lost: 32 bytes in 1 blocks
==2210== indirectly lost: 0 bytes in 0 blocks
==2210== possibly lost: 0 bytes in 0 blocks
==2210== still reachable: 20,215 bytes in 71 blocks
==2210== suppressed: 0 bytes in 0 blocks
==2210== Rerun with --leak-check=full to see details of leaked memory
==2210==
==2210== For counts of detected and suppressed errors, rerun with: -v
==2210== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2) |
I have just re-ran valgrind scenario above, this time with DBG on. There's lot more info now, and even some stuff related to ==2231== Memcheck, a memory error detector
==2231== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2231== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2231== Command: php -S 0.0.0.0:9009 router.php
==2231==
==2231== Conditional jump or move depends on uninitialised value(s)
==2231== at 0x7FFF7D1: getenv (getenv.c:89)
==2231== by 0x70FAA9: zif_getenv (basic_functions.c:4059)
==2231== by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231== by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x8CA719: ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER (zend_vm_execute.h:2738)
==2231== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231== by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x81B4C8: zend_execute_scripts (zend.c:1316)
==2231== by 0x8D0231: php_cli_server_dispatch_router.isra.11 (php_cli_server.c:2014)
==2231== by 0x8D27B0: php_cli_server_recv_event_read_request (php_cli_server.c:2053)
==2231==
==2231== Conditional jump or move depends on uninitialised value(s)
==2231== at 0x7FFF7D1: getenv (getenv.c:89)
==2231== by 0x7C9BAD: php_get_temporary_directory (php_open_temporary_file.c:234)
==2231== by 0x6C609C: ps_open_files (mod_files.c:269)
==2231== by 0x6C1C90: php_session_initialize (session.c:448)
==2231== by 0x6C4B84: php_session_start (session.c:1450)
==2231== by 0xFA92ABC: phalcon_session_start (session.c:33)
==2231== by 0xFC7193E: zim_Phalcon_Session_Adapter_start (adapter.c:127)
==2231== by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x80C0AD: zend_call_function (zend_execute_API.c:959)
==2231== by 0xFA76E1E: phalcon_call_user_func_array_noex (fcall.c:510)
==2231== by 0xFC8B278: phalcon_call_user_func_array (fcall.h:656)
==2231== by 0xFC8DC64: zim_Phalcon_DI_Service_Builder_build (builder.c:408)
==2231==
==2231== Conditional jump or move depends on uninitialised value(s)
==2231== at 0x7FFF7D1: getenv (getenv.c:89)
==2231== by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231== by 0x4A2B27: seek_to_tz_position (parse_tz.c:269)
==2231== by 0x4A2E13: timelib_timezone_id_is_valid (parse_tz.c:312)
==2231== by 0x47E2DC: guess_timezone.part.26 (php_date.c:956)
==2231== by 0x480102: get_timezone_info (php_date.c:939)
==2231== by 0x484054: php_date_initialize (php_date.c:2588)
==2231== by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231== by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231== by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==
==2231== Conditional jump or move depends on uninitialised value(s)
==2231== at 0x7FFF7D1: getenv (getenv.c:89)
==2231== by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231== by 0x4A2BC4: seek_to_tz_position (parse_tz.c:283)
==2231== by 0x4A2E13: timelib_timezone_id_is_valid (parse_tz.c:312)
==2231== by 0x47E2DC: guess_timezone.part.26 (php_date.c:956)
==2231== by 0x480102: get_timezone_info (php_date.c:939)
==2231== by 0x484054: php_date_initialize (php_date.c:2588)
==2231== by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231== by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231== by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==
==2231== Conditional jump or move depends on uninitialised value(s)
==2231== at 0x7FFF7D1: getenv (getenv.c:89)
==2231== by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231== by 0x4A2B27: seek_to_tz_position (parse_tz.c:269)
==2231== by 0x4A2E42: timelib_parse_tzfile (parse_tz.c:320)
==2231== by 0x47D8D2: php_date_parse_tzfile (php_date.c:900)
==2231== by 0x480119: get_timezone_info (php_date.c:975)
==2231== by 0x484054: php_date_initialize (php_date.c:2588)
==2231== by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231== by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231== by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==
==2231== Conditional jump or move depends on uninitialised value(s)
==2231== at 0x7FFF7D1: getenv (getenv.c:89)
==2231== by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231== by 0x4A2BC4: seek_to_tz_position (parse_tz.c:283)
==2231== by 0x4A2E42: timelib_parse_tzfile (parse_tz.c:320)
==2231== by 0x47D8D2: php_date_parse_tzfile (php_date.c:900)
==2231== by 0x480119: get_timezone_info (php_date.c:975)
==2231== by 0x484054: php_date_initialize (php_date.c:2588)
==2231== by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231== by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231== by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==
==2231== Invalid read of size 4
==2231== at 0x405D03E: dbg_send_log (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x40547CE: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== by 0x83492D: zend_throw_exception_internal (zend_exceptions.c:116)
==2231== by 0xFA8FEDF: phalcon_throw_exception_zval (exception.c:56)
==2231== by 0xFBC465E: zim_Phalcon_Mvc_Model_Query__getQualified (query.c:524)
==2231== by 0xFA950D4: phalcon_alt_call_method (fcall.c:801)
==2231== by 0xFA95919: phalcon_alt_call_user_method (fcall.c:929)
==2231== by 0xFA76638: phalcon_call_method_vparams (fcall.c:336)
==2231== by 0xFA767AC: phalcon_call_method_params (fcall.c:375)
==2231== by 0xFBC66F0: zim_Phalcon_Mvc_Model_Query__getExpression (query.c:813)
==2231== by 0xFA950D4: phalcon_alt_call_method (fcall.c:801)
==2231== by 0xFA95919: phalcon_alt_call_user_method (fcall.c:929)
==2231== Address 0x14b785ec is 76 bytes inside a block of size 78 alloc'd
==2231== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2231== by 0x7F48C0: _estrndup (zend_alloc.c:2650)
==2231== by 0x8257A5: zend_update_property_string (zend_API.c:3774)
==2231== by 0x832737: zend_default_exception_new_ex (zend_exceptions.c:163)
==2231== by 0x8327BA: zend_default_exception_new (zend_exceptions.c:173)
==2231== by 0x81D3B1: _object_and_properties_init (zend_API.c:1200)
==2231== by 0xFA8FE80: phalcon_throw_exception_zval (exception.c:53)
==2231== by 0xFBC465E: zim_Phalcon_Mvc_Model_Query__getQualified (query.c:524)
==2231== by 0xFA950D4: phalcon_alt_call_method (fcall.c:801)
==2231== by 0xFA95919: phalcon_alt_call_user_method (fcall.c:929)
==2231== by 0xFA76638: phalcon_call_method_vparams (fcall.c:336)
==2231== by 0xFA767AC: phalcon_call_method_params (fcall.c:375)
==2231== |
There's clearly a bug somewhere in Phalcon\Session\Bag that affects Models. The case is complicated, I don't have a code to reproduce it. It needs to be looked at in the scope of my application. I'll be happy to roll out a Rackspace cloud instance and give root access to whoever finds time to work on this. Thanks! |
Hi, I also have the crash, but not on every computer, and not if I run the script with CLI. A simple line like that will crash: But as outlined by @temuri416 , it does not crash when in CLI. Any input on that bug? I am using Phalcon 1.3.2 with PHP 5.5. Also, I don't have/use sessions right now. This is a simple code. If I may, I consider that this bug is blocking, not medium, as long as I can't use my DB. Thank you in advance, |
@RenaudParis @temuri416 Could you try it under 2.0? |
@Green-Cat Why? |
@temuri416 Both components were rewritten while keeping the same external api. |
That's good. But I'm not switching to Phalcon 2.0 just yet. I'll test when I get there. |
Could you please check if this still happen in 2.0.x? |
2.0.x seems to work fine. |
Thanks |
Hi,
It looks like last month has been rough on Phalcon branch 1.3.0.
My code has suddenly stopped working as a result of commit 7e54b69:
Thanks!
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: