Skip to content

Misleading warning if session-size > 1MB #333

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

Closed
ralfbecker opened this issue Feb 27, 2017 · 5 comments
Closed

Misleading warning if session-size > 1MB #333

ralfbecker opened this issue Feb 27, 2017 · 5 comments

Comments

@ralfbecker
Copy link

Took me a while to debug why code working with old php-memcache failed with php-memcached: Old extension split large sessions into 1MB junks to store in memcached. New one tries to write them to memcached, which fails because memcached does not store anything larger then 1MB, which results in two warnings:

PHP Warning: session_write_close(): error saving session to memcached: SUCCESS
PHP Warning: session_write_close(): Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (memcached1:11211,memcached2:11211)

Both are not helpful, as they don't explain the real issue.

Maybe giving a more explicit warning like: tried to store session data > 1MB failed (php-memcached does NOT support splitting it in multiple memcached requests)

To get me right: I'm fine with not supporting it, as it does not make much sense to store such big data in the session in the first place.

@sodabrew sodabrew added this to the 3.0.4 milestone Feb 27, 2017
@sodabrew
Copy link
Contributor

Great suggestion to check for a large session and produce a better error message.

@sodabrew sodabrew modified the milestones: 3.1.0, 3.0.4 Mar 16, 2017
@sodabrew
Copy link
Contributor

The line of code that produces the message is:

php_error_docref(NULL TSRMLS_CC, E_WARNING, "error saving session to memcached: %s", memcached_last_error_message(memc));

The documentation for memcached_last_error_message http://docs.libmemcached.org/libmemcached/memcached_last_error_message.html suggests that a more helpful message would be produced. In fact, producing an error-text of "SUCCESS" when the return value of memcached_set() is not MEMCACHED_SUCCESS doesn't make sense to me.

@sodabrew
Copy link
Contributor

I see no such code in the older memcache extension to split up sessions. Where are you seeing this behavior implemented?

https://git.php.net/?p=pecl/caching/memcache.git;a=blob;f=memcache_session.c;h=6895ab33675c3089d04c16a3eda60d5ca1de2967;hb=HEAD

@ralfbecker
Copy link
Author

ralfbecker commented Mar 16, 2017 via email

@linusnorton
Copy link

I'm receiving this error (error saving session to memcached: SUCCESS) too but it doesn't seem to be session size related. Are there any other possible causes?

@sodabrew sodabrew removed this from the 3.1.0 milestone Jan 20, 2018
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

No branches or pull requests

3 participants