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

session_start(): Failed to read session data: memcache using php7.2 #57

Closed
kmille opened this issue Jul 12, 2019 · 7 comments · Fixed by #76
Closed

session_start(): Failed to read session data: memcache using php7.2 #57

kmille opened this issue Jul 12, 2019 · 7 comments · Fixed by #76

Comments

@kmille
Copy link

kmille commented Jul 12, 2019

Hey,

I tried some debugging but I think php is the problem:

php-fpm configuration

php_admin_value[session.save_handler] = memcache
php_admin_value[session.save_path] = tcp://10.100.128.54:11211, tcp://10.100.128.55:11211

Error message:

[12-Jul-2019 10:31:32 Europe/Berlin] PHP Warning:  session_start(): Failed to read session data: memcache (path: tcp://10.100.128.54:11211, tcp://10.100.128.55:11211) in /var/www/vhosts/cuschtomer/htdocs/backend/__test_dc1_memcached.php on line 11

Test file:

<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

#echo $_SERVER['SERVER_ADDR'];
#ini_set("memcache
session_start();
#$_SESSION["dc1"] = "test";
#echo $_SESSION["dc1"];
#phpinfo();
echo "done\n";
?>

ngrep log:

root@cuschtomer:~# ngrep -d any -q -W byline port 11211 and host 10.100.128.54
interface: any
filter: ( port 11211 and host 10.100.128.54 ) and (ip || ip6)

T 10.100.128.160:44808 -> 10.100.128.54:11211 [AP] #4
incr r9v63n79qkva4igrme08vce2n3.lock 1.

T 10.100.128.160:44808 -> 10.100.128.54:11211 [AP] #6
add r9v63n79qkva4igrme08vce2n3.lock 768 15 1.
1.
get r9v63n79qkva4igrme08vce2n3.

T 10.100.128.54:11211 -> 10.100.128.160:44808 [AP] #7
NOT_FOUND.

T 10.100.128.54:11211 -> 10.100.128.160:44808 [AP] #9
STORED.

T 10.100.128.54:11211 -> 10.100.128.160:44808 [AP] #11
END.

We are using php7.2-fpm on Ubuntu 18.04 with php-memcache (3.0.9~20160311.4991c2f-5build2). The Memcached server runs on Ubuntu 16.04 (1.4.25-2ubuntu1.2). There are no erros in the log file. Any idea what's wrong?

Greetings

kmille

@kmille
Copy link
Author

kmille commented Jul 24, 2019

any updates?

@tomassrnka
Copy link
Member

Hi, sorry we are on holidays, i will take a look at it next week when im back.

@kmille
Copy link
Author

kmille commented Sep 16, 2019

Hey, still on holiday? We came across the same bug today after upgrading to 18.04 for a different customer.

@kmille
Copy link
Author

kmille commented Sep 16, 2019

For me it just looks like you return the wrong value. Like: return error; (even if everything works)
probably just this: https://github.com/php/php-src/blob/master/ext/session/session.c#L441
I currently don't have the time to make a PR (+ I don't exactly where I need to patch it)

@tomassrnka
Copy link
Member

tomassrnka commented Sep 21, 2019

@kmille I tried to reproduce the bug, yes it is there with php-memcache from Ubuntu 18.04, however if you use latest release from this repo, it works as expected.
# php a.php
done

@tomassrnka
Copy link
Member

@kmille -> could you please try it with current pecl-memcache extension from our repo? It should be pretty easy to build.

# install deps
apt-get install  php7.2-dev git make 

# Build extension
CFLAGS="-fstack-protector-strong -fpic -fpie -O2"
CPPFLAGS="$PHP_CFLAGS"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie"
set -eux
cd /usr/src
git clone https://github.com/websupport-sk/pecl-memcache.git
cd pecl-memcache; 
phpize 
./configure 
make -j$(nproc)

# remove old one
apt-get remove php7.2-memcache # or php-memcache

make install 

This was referenced Oct 8, 2020
@thesource93 thesource93 linked a pull request Oct 16, 2020 that will close this issue
@kmille
Copy link
Author

kmille commented Feb 1, 2021

Hey,
thanks for caring! We upgraded the system so I can't reproduce it anymore.

@kmille kmille closed this as completed Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants