php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63561 When I pass an invalid argument to Memcached::get() I get "PHP Fatal error:"
Submitted: 2012-11-19 10:59 UTC Modified: 2021-06-09 11:52 UTC
From: zlobnygrif at gmail dot com Assigned: cmb (profile)
Status: Closed Package: memcached (PECL)
PHP Version: 5.4.8 OS: Ubuntu 12.04, Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: zlobnygrif at gmail dot com
New email:
PHP Version: OS:

 

 [2012-11-19 10:59 UTC] zlobnygrif at gmail dot com
Description:
------------
When I pass an invalid argument to Memcached::get() I get "PHP Fatal error:  Maximum execution time"


My php:
---------------
% php -v
PHP 5.4.8-1~precise+1 (cli) (built: Oct 29 2012 14:58:46) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.2.0, Copyright (c) 2002-2012, by Derick Rethans


Memcached version:
---------------
% php -i | grep memcache
/etc/php5/cli/conf.d/20-memcached.ini,
memcached
memcached support => enabled
libmemcached version => 1.0.8
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
memcached.serializer => php => php
memcached.sess_binary => 0 => 0
memcached.sess_lock_wait => 150000 => 150000
memcached.sess_locking => 1 => 1
memcached.sess_prefix => memc.sess.key. => memc.sess.key.
Registered save handlers => files user memcached

Test script:
---------------
ini_set("max_execution_time", 5);
$e = new Memcached();
var_dump(
  $e->addServer("/tmp/memcached.socket", 0),
  $e->add("somekey", "Test!", time() + 1),
  $e->get("some\nkey")
);

Expected result:
----------------
bool(true)
bool(true)
bool(false)

Actual result:
--------------
bool(true)
bool(true)
bool(false)
PHP Fatal error:  Maximum execution time of 5 seconds exceeded in Unknown on line 0

Fatal error: Maximum execution time of 5 seconds exceeded in Unknown on line 0


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-20 04:48 UTC] andrei@php.net
What version of memcached server are you running?
 [2012-11-20 10:45 UTC] zlobnygrif at gmail dot com
% dpkg -l | grep -i memcached
ii  libmemcached10                             1.0.8-1~precise+1
ii  memcached                                  1.4.13-0ubuntu2caching
ii  php5-memcached                             2.1.0-2~precise+1
 [2012-11-20 10:56 UTC] zlobnygrif at gmail dot com
Memcached server
------------
% memcached -h | head -n1
memcached 1.4.13
% cat /etc/memcached.conf | sed -E '/^(#.*)?$/d'
-d
logfile /var/log/memcached.log
-m 512
-s /tmp/memcached.socket
-a 0777
-u nobody
 [2012-11-21 03:58 UTC] andrei@php.net
I can't seem to reproduce it. I get the expected output.

Do you know how to use gdb?
 [2012-11-22 05:05 UTC] zlobnygrif at gmail dot com
I am not sure how to use it

Test script
------------------
% gdb php
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /usr/local/bin/php...(no debugging symbols found)...done.
(gdb) run -r 'ini_set("max_execution_time", 5); $e = new Memcached(); var_dump($e->addServer("/tmp/memcached.socket", 0), $e->add("somekey", "Test!", time() + 1), $e->get("some\nkey"));'
Starting program: /usr/local/bin/php -r 'ini_set("max_execution_time", 5); $e = new Memcached(); var_dump($e->addServer("/tmp/memcached.socket", 0), $e->add("somekey", "Test!", time() + 1), $e->get("some\nkey"));'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[New Thread 0xb6011b40 (LWP 1467)]
[Thread 0xb6011b40 (LWP 1467) exited]
bool(true)
bool(true)
bool(false)
PHP Fatal error:  Maximum execution time of 5 seconds exceeded in Unknown on line 0

Fatal error: Maximum execution time of 5 seconds exceeded in Unknown on line 0

[Inferior 1 (process 1464) exited with code 0377]
(gdb) bt
No stack.
(gdb) quit



Memcached
------------------
% sudo gdb memcached
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /usr/bin/memcached...(no debugging symbols found)...done.
(gdb) run -s /tmp/memcached.socket -a 0777 -u nobody
Starting program: /usr/bin/memcached -s /tmp/memcached.socket -a 0777 -u nobody
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[New Thread 0xb7d28b40 (LWP 1447)]
[New Thread 0xb7527b40 (LWP 1448)]
[New Thread 0xb6d26b40 (LWP 1449)]
[New Thread 0xb6525b40 (LWP 1450)]
[New Thread 0xb5d24b40 (LWP 1451)]
^C
Program received signal SIGINT, Interrupt.
0xb7fdd424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fdd424 in __kernel_vsyscall ()
#1  0xb7e968f6 in epoll_wait () from /lib/i386-linux-gnu/libc.so.6
#2  0xb7f983dc in ?? () from /usr/lib/libevent-2.0.so.5
#3  0xb7f82be7 in event_base_loop () from /usr/lib/libevent-2.0.so.5
#4  0x0804b1e8 in ?? ()
#5  0xb7dc04d3 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
#6  0x0804b9c1 in ?? ()
(gdb) quit
 [2012-11-22 16:47 UTC] andrei@php.net
Run the script from gdb, then as soon as you see the last line of the expected 
output, hit Ctrl-C, which will drop you back to gdb command line. Then type "bt" 
and press enter and paste the result here.
 [2012-11-26 10:47 UTC] zlobnygrif at gmail dot com
[Thread 0xb6011b40 (LWP 30355) exited]
bool(true)
bool(true)
bool(false)
^C
Program received signal SIGINT, Interrupt.
0xb7fdd424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fdd424 in __kernel_vsyscall ()
#1  0xb786e866 in gettimeofday () from /lib/i386-linux-gnu/libc.so.6
#2  0xb659760f in memcached_quit_server(memcached_server_st*, bool) () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#3  0xb6595833 in memcached_io_reset(memcached_server_st*) () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#4  0xb65981ba in ?? () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#5  0xb6598dfd in memcached_read_one_response(memcached_server_st*, memcached_result_st*) () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#6  0xb6597437 in memcached_purge () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#7  0xb6594ef5 in ?? () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#8  0xb65954f5 in memcached_io_write(memcached_server_st*) () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#9  0xb6595600 in memcached_io_writev(memcached_server_st*, libmemcached_io_vector_st*, unsigned int, bool) () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#10 0xb658f07d in memcached_vdo(memcached_server_st*, libmemcached_io_vector_st*, unsigned int, bool) () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#11 0xb65976fa in memcached_quit_server(memcached_server_st*, bool) () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#12 0xb65977ef in send_quit(memcached_st*) () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#13 0xb6595bcd in ?? () from /usr/lib/i386-linux-gnu/libmemcached.so.10
#14 0xb660e64c in ?? () from /usr/lib/php5/20100525+lfs/memcached.so
#15 0xb660ee96 in ?? () from /usr/lib/php5/20100525+lfs/memcached.so
#16 0x0834f3a2 in zend_objects_store_del_ref_by_handle_ex (handle=<unknown type>, handlers=0x1) at /build/buildd/php5-5.4.8/Zend/zend_objects_API.c:220
#17 0x0834f3df in zend_objects_store_del_ref (zobject=0x8324d59) at /build/buildd/php5-5.4.8/Zend/zend_objects_API.c:172
#18 0x08324d59 in _zval_dtor_func (zvalue=0x8315ffd) at /build/buildd/php5-5.4.8/Zend/zend_variables.c:52
#19 0x08315ffd in _zval_ptr_dtor (zval_ptr=0x8332c06) at /build/buildd/php5-5.4.8/Zend/zend_variables.h:35
#20 0x08332c06 in zend_hash_apply_deleter () at /build/buildd/php5-5.4.8/Zend/zend_hash.c:650
#21 0x083346e6 in zend_hash_reverse_apply (ht=0x87e57d8, apply_func=0xb776a030) at /build/buildd/php5-5.4.8/Zend/zend_hash.c:804
#22 0x08316334 in shutdown_destructors () at /build/buildd/php5-5.4.8/Zend/zend_execute_API.c:217
#23 0x08325ebd in zend_call_destructors () at /build/buildd/php5-5.4.8/Zend/zend.c:922
#24 0x082bfad5 in php_request_shutdown (dummy=0x871ddab) at /build/buildd/php5-5.4.8/main/main.c:1732
---Type <return> to continue, or q <return> to quit---
#25 0x083d6b72 in do_cli (argc=0, argv=0x0) at /build/buildd/php5-5.4.8/sapi/cli/php_cli.c:1171
#26 0x0806b35e in main (argc=3, argv=0xbffff794) at /build/buildd/php5-5.4.8/sapi/cli/php_cli.c:1364
(gdb)
 [2021-06-09 11:52 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-09 11:52 UTC] cmb@php.net
The memcached bug tracker is now on Github[1].  If this is still
an issue with the current memcached version, please report there.

[1] <https://github.com/php-memcached-dev/php-memcached/issues>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC