On Thu, Jun 09, 2011 at 12:10:07PM +0200, Josip Rodin wrote: > Package: php5-memcache > Version: 3.0.4-4 > Severity: grave > > Hi, > > Something in the squeeze upgrade completely demolished one of our internal > PHP applications... our class that extends Memcache and calls parent::get() > never returns from the call into memcache.so, whenever memcached is up. > If I stop the daemon, the code prints a warning and proceeds. > > The setup is fairly trivial - the class constructor calls: > > $this->addServer("127.0.0.1", "11211", false); > > This seems to work (because the calling script proceeds normally after it). > > And then the get() method is called, defined like this: > > function get($key, $flags = null) { > $key = $this->key_prefix.$key; > error_log("will now call parent::get($key, $flags)"); > $ret = parent::get($key, $flags); > error_log("have called parent::get($key, $flags)"); > $this->_record_module_stats('get'); > return $ret; > } > > Nothing fancy, really. The first log line is printed, the second isn't - the > script just dies there, causing mod_php to render an empty page etc. Apache > error log says: > > [Thu Jun 09 12:04:10 2011] [notice] child pid 32175 exit signal Segmentation > fault (11) > > The strace of the Apache child is (redacted): > > gettimeofday({1307613917, 639870}, NULL) = 0 > socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3146 > fcntl(3146, F_GETFL) = 0x2 (flags O_RDWR) > fcntl(3146, F_SETFL, O_RDWR|O_NONBLOCK) = 0 > connect(3146, {sa_family=AF_INET, sin_port=htons(11211), > sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in > progress) > poll([{fd=3146, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 1000) = 1 > ([{fd=3146, revents=POLLOUT}]) > getsockopt(3146, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 > fcntl(3146, F_SETFL, O_RDWR) = 0 > fcntl(3146, F_GETFL) = 0x2 (flags O_RDWR) > fcntl(3146, F_SETFL, O_RDWR|O_NONBLOCK) = 0 > select(3147, [1024 1223 1224 1227 1230 1231 1235 1241 1242 1243 1244 1245 > 1252 1255 1256 1257 1258 1259 1260 1261 1262 1284 1285 1287 1288 1291 1294 > 1295 1299 1305 1306 1307 1308 1309 1316 1319 1320 1321 1322 1323 1324 1325 > 1326 1347 1348 1350 1352 1353 1354 1355 1356 1357 1358 1360 1363 1364 1365 > 1369 1370 1371 1372 1373 1380 1383 1384 1385 1386 1387 1388 1389 1390 1409 > 1411 1412 1504 1731 1732 1734 1737 1738 1739 1740 1741 1742 1744 1747 1748 > 1749 1753 1754 1755 1756 1757 1764 1767 1768 1769 1770 1771 1772 1773 1774 > 1793 1795 1796 1888 2122 2497 2499 2500 2503 2504 2507 2508 2511 2512 2515 > 2516 2519 2520 2523 2524 2527 2528 2531 2532 2535 2536 2539 2540 2543 2544 > 2547 2550 2551 2552 2553 2554 2555 2556 2557 2565 2569 2570 2571 2574 2630 > 2631 2632 2633 2635 2636 2640 2643 2646 2651 2653 2660 2663 2664 2665 2666 > 2667 2668 2669 2670 2752 2753 2756 2757 2765 2768 2772 2777 2778 2779 2780 > 2783 2784 2785 2786 2787 2788 2789 2790 2791 2794 2797 2799 2800 2802 2803 > 2806 2808 2809 2811 2812 2817 2818 2827 2828 2829 > 2834 2835 2837 2838 2839 2841 2842 2844 2846 2849 2850 2852 2853 2856 2859 > 2860 2862 2863 2864 2866 2867 2870 2871 2872 2873 2874 2879 2880 2884 2886 > 2944 2948 2949 2953 3013 3073 3074 3075 3078 3080 3081 3082 3083 3085 3088 > 3089 3090 3091 3095 3099 3101 3104 3105 3107 3110 3115 3121 3122 3124 3126 > 3127 3129 3133 3134 3135 3139 3142 3145 3146], [2048 2247 2248 2251 2254 2255 > 2259 2265 2266 2267 2268 2269 2276 2279 2280 2281 2282 2283 2284 2285 2286 > 2308 2309 2311 2312 2315 2318 2319 2323 2329 2330 2331 2332 2333 2340 2343 > 2344 2345 2346 2347 2348 2349 2350 2371 2372 2374 2376 2377 2378 2379 2380 > 2381 2382 2384 2387 2388 2389 2393 2394 2395 2396 2397 2404 2407 2408 2409 > 2410 2411 2412 2413 2414 2433 2435 2436 2528 2755 2756 2758 2761 2762 2763 > 2764 2765 2766 2768 2771 2772 2773 2777 2778 2779 2780 2781 2788 2791 2792 > 2793 2794 2795 2796 2797 2798 2817 2819 2820 2912 3146], NULL, {1, 0}) = 376 > (in [1024 1223 1224 1227 1230 1231 1235 1241 1242 1243 1244 1245 1252 1255 > 1256 1257 1258 1259 1260 1261 1262 1284 12 > 85 1287 1288 1291 1294 1295 1299 1305 1306 1307 1308 1309 1316 1319 1320 1321 > 1322 1323 1324 1325 1326 1347 1348 1350 1352 1353 1354 1355 1356 1357 1358 > 1360 1363 1364 1365 1369 1370 1371 1372 1373 1380 1383 1384 1385 1386 1387 > 1388 1389 1390 1409 1411 1412 1504 1731 1732 1734 1737 1738 1739 1740 1741 > 1742 1744 1747 1748 1749 1753 1754 1755 1756 1757 1764 1767 1768 1769 1770 > 1771 1772 1773 1774 1793 1795 1796 1888 2122 2497 2499 2500 2503 2504 2507 > 2508 2511 2512 2515 2516 2519 2520 2523 2524 2527 2528 2531 2532 2535 2536 > 2539 2540 2543 2544 2547 2550 2551 2552 2553 2554 2555 2556 2557 2565 2569 > 2570 2571 2574 2630 2631 2632 2633 2635 2636 2640 2643 2646 2651 2653 2660 > 2663 2664 2665 2666 2667 2668 2669 2670 2752 2753 2756 2757 2765 2768 2772 > 2777 2778 2779 2780 2783 2784 2785 2786 2787 2788 2789 2790 2791 2794 2797 > 2799 2800 2802 2803 2806 2808 2809 2811 2812 2817 2818 2827 2828 2829 2834 > 2835]]) > sendto(3146, "get test-strix-joy-zg_news_1_new"..., 55, MSG_NOSIGNAL, NULL, > 0) = 55 > select(3147, [1024 1219 1221 1222 1224 1227 1230 1231 1235 1241 1242 1243 > 1244 1245 1252 1255 1256 1257 1258 1259 1260 1261 1262 1283 1284 1287 1288 > 1291 1294 1295 1299 1305 1306 1307 1308 1309 1316 1319 1320 1321 1322 1323 > 1324 1325 1326 1347 1348 1350 1352 1353 1354 1355 1356 1357 1358 1360 1363 > 1364 1365 1369 1370 1371 1372 1373 1380 1383 1384 1385 1386 1387 1388 1389 > 1390 1409 1411 1412 1731 1732 1734 1737 1738 1739 1740 1741 1742 1744 1747 > 1748 1749 1753 1754 1755 1756 1757 1764 1767 1768 1769 1770 1771 1772 1773 > 1774 1793 1795 1796 1924 1925 1927 1928 1930 1933 1934 1935 1936 1939 1940 > 1942 1945 1946 1947 1948 1949 1956 1959 1960 1961 1962 1963 1964 1965 1966 > 1985 1987 1988 2080 2497 2499 2500 2503 2504 2507 2508 2511 2512 2515 2516 > 2519 2520 2523 2524 2527 2528 2531 2532 2535 2536 2539 2540 2543 2544 2547 > 2550 2551 2552 2553 2554 2555 2556 2557 2565 2569 2570 2571 2574 2630 2631 > 2632 2633 2635 2636 2640 2643 2646 2651 2653 2660 2663 2664 2665 2666 2667 > 2668 2669 2670 2752 2753 2756 2757 2765 2768 2772 > 2777 2778 2779 2780 2783 2784 2785 2786 2787 2788 2789 2790 2791 2794 2797 > 2799 2800 2802 2803 2806 2808 2809 2811 2812 2817 2818 2827 2828 2829 2834 > 2835 2837 2838 2839 2841 2842 2844 2846 2849 2850 2852 2853 2856 2859 2860 > 2862 2863 2864 2866 2867 2870 2871 2872 2873 2874 2879 2880 2884 2886 2944 > 2948 2949 2953 3013 3073 3074 3075 3078 3080 3081 3082 3083 3085 3088 3089 > 3090 3091 3095 3099 3101 3104 3105 3107 3110 3115 3121 3122 3124 3126 3127 > 3129 3133 3134 3135 3139 3145 3146], [2048 2243 2245 2246 2248 2251 2254 2255 > 2259 2265 2266 2267 2268 2269 2276 2279 2280 2281 2282 2283 2284 2285 2286 > 2307 2308 2311 2312 2315 2318 2319 2323 2329 2330 2331 2332 2333 2340 2343 > 2344 2345 2346 2347 2348 2349 2350 2371 2372 2374 2376 2377 2378 2379 2380 > 2381 2382 2384 2387 2388 2389 2393 2394 2395 2396 2397 2404 2407 2408 2409 > 2410 2411 2412 2413 2414 2433 2435 2436 2755 2756 2758 2761 2762 2763 2764 > 2765 2766 2768 2771 2772 2773 2777 2778 2779 2780 2781 2788 2791 2792 2793 > 2794 2795 2796 2797 2798 2817 2819 2820 2948 > 2949 2951 2952 2954 2957 2958 2959 2960 2963 2964 2966 2969 2970 2971 2972 > 2973 2980 2983 2984 2985 2986 2987 2988 2989 2990 3009 3011 3012 3104], NULL, > {1, 0}) = 435 (in [1024 1219 1221 1222 1224 1227 1230 1231 1235 1241 1242 > 1243 1244 1245 1252 1255 1256 1257 1258 1259 1260 1261 1262 1283 1284 1287 > 1288 1291 1294 1295 1299 1305 1306 1307 1308 1309 1316 1319 1320 1321 1322 > 1323 1324 1325 1326 1347 1348 1350 1352 1353 1354 1355 1356 1357 1358 1360 > 1363 1364 1365 1369 1370 1371 1372 1373 1380 1383 1384 1385 1386 1387 1388 > 1389 1390 1409 1411 1412 1731 1732 1734 1737 1738 1739 1740 1741 1742 1744 > 1747 1748 1749 1753 1754 1755 1756 1757 1764 1767 1768 1769 1770 1771 1772 > 1773 1774 1793 1795 1796 1924 1925 1927 1928 1930 1933 1934 1935 1936 1939 > 1940 1942 1945 1946 1947 1948 1949 1956 1959 1960 1961 1962 1963 1964 1965 > 1966 1985 1987 1988 2080 2497 2499 2500 2503 2504 2507 2508 2511 2512 2515 > 2516 2519 2520 2523 2524 2527 2528 2531 2532 2535 2536 2539 2540 2543 2544 > 2547 2550 2551 2552 2553 2554 2555 2556 2557 > 2565 2569 2570 2571 2574 2630 2631 2632 2633 2635 2636 2640 2643 2646 2651 > 2653 2660 2663 2664 2665 2666 2667 2668 2669 2670 2752 2753 2756 2757 2765 > 2768 2772 2777 2778]]) > recvfrom(3146, "END\r\n", 32768, 0, NULL, NULL) = 5 > --- SIGSEGV (Segmentation fault) @ 0 (0) --- > chdir("/etc/apache2") = 0 > rt_sigaction(SIGSEGV, {SIG_DFL, [], SA_RESTORER|SA_INTERRUPT, > 0x7f9030d04f60}, {SIG_DFL, [], SA_RESTORER|SA_RESETHAND, 0x7f9030d04f60}, 8) > = 0 > kill(32179, SIGSEGV) = 0 > rt_sigreturn(0x7db3) = 140257496913240 > --- SIGSEGV (Segmentation fault) @ 0 (0) --- > Process 32179 detached > > The packet trace is: > > ]% sudo tshark -n -i lo port 11211 > Running as user "root" and group "root". This could be dangerous. > Capturing on lo > 0.000000 127.0.0.1 -> 127.0.0.1 TCP 56058 > 11211 [SYN] Seq=0 > Win=32792 Len=0 MSS=16396 TSV=131923426 TSER=0 WS=7 > 0.000026 127.0.0.1 -> 127.0.0.1 TCP 11211 > 56058 [SYN, ACK] Seq=0 > Ack=1 Win=32768 Len=0 MSS=16396 TSV=131923426 TSER=131923426 WS=7 > 0.000047 127.0.0.1 -> 127.0.0.1 TCP 56058 > 11211 [ACK] Seq=1 Ack=1 > Win=32896 Len=0 TSV=131923426 TSER=131923426 > 0.000219 127.0.0.1 -> 127.0.0.1 MEMCACHE get > test-strix-joy-zg_news_1_news_type.global='t'_290 > 0.000245 127.0.0.1 -> 127.0.0.1 TCP 11211 > 56058 [ACK] Seq=1 Ack=56 > Win=32768 Len=0 TSV=131923426 TSER=131923426 > 0.000301 127.0.0.1 -> 127.0.0.1 MEMCACHE END > 0.000327 127.0.0.1 -> 127.0.0.1 TCP 56058 > 11211 [ACK] Seq=56 Ack=6 > Win=32896 Len=0 TSV=131923426 TSER=131923426 > 0.014678 127.0.0.1 -> 127.0.0.1 TCP 56058 > 11211 [FIN, ACK] Seq=56 > Ack=6 Win=32896 Len=0 TSV=131923430 TSER=131923426 > 0.014767 127.0.0.1 -> 127.0.0.1 TCP 11211 > 56058 [FIN, ACK] Seq=6 > Ack=57 Win=32768 Len=0 TSV=131923430 TSER=131923430 > 0.014788 127.0.0.1 -> 127.0.0.1 TCP 56058 > 11211 [ACK] Seq=57 Ack=7 > Win=32896 Len=0 TSV=131923430 TSER=131923430 > > Maybe I'm doing something wrong, but the PHP library should never segfault > while talking with an apparently functional memcached. > > Please fix it. TIA.
Hah, I found the apparent problem. The number of fds in those select() calls tipped me off to reexamine a change I recently did as part of the squeeze upgrade - I enabled a large number of virtual hosts which forced me to call 'ulimit -n 4096' in the apache2 init script. When I disabled >1500 virtual hosts and reduced their number to just 3, everything was just fine again. Please reassign the bug elsewhere if this is not actually specific to memcache.so - this is happening with: * libapache2-mod-php5 Version: 5.3.3-7+squeeze1 * apache2-mpm-prefork Version: 2.2.16-6+squeeze1 -- 2. That which causes joy or happiness. -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org