Skip to content

[DX] [Session] Improve error message when session write fails #20807

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
digilist opened this issue Dec 7, 2016 · 4 comments
Closed

[DX] [Session] Improve error message when session write fails #20807

digilist opened this issue Dec 7, 2016 · 4 comments
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) HttpFoundation

Comments

@digilist
Copy link
Contributor

digilist commented Dec 7, 2016

I got the following error message with Symfony, because a session write failed:

session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions)

It took me some to figure out the cause for this. It has nothing to do with the save_path, but this was the first thing I looked into, when trying to solve the issue. However, the actual reason for this error was a wrongly configured memcached host. So the connection to memcached failed and I didn't remember that I had configured memcached sessions at that moment.

I propose to catch the error message and extend it with some useful information (here).

It looks like there is currently no way to get the name of the current save handler, as it is wrapped into a proxy. So we would have to introduce a way to get the current class name (or anything else) to name the current save handler.

If you think this is useful, I'd like to submit a PR.

There is also issue #17845 where many other users had this error and did not find a solution. I don't know, if there was any case in which it had a similar cause, but I think a better error message might help in similar situation.

@javiereguiluz javiereguiluz added DX DX = Developer eXperience (anything that improves the experience of using Symfony) HttpFoundation labels Dec 7, 2016
@xabbuh
Copy link
Member

xabbuh commented Dec 13, 2016

@digilist Would you mind creating a pull request?

@digilist
Copy link
Contributor Author

Sure, I'll look into it in a few days.

@jakzal
Copy link
Contributor

jakzal commented Jan 25, 2017

@digilist any news? :)

@digilist
Copy link
Contributor Author

Yes, sorry. I just opend PR #21421.

@fabpot fabpot closed this as completed Mar 5, 2017
fabpot added a commit that referenced this issue Mar 5, 2017
… (digilist)

This PR was submitted for the 2.8 branch but it was merged into the 3.3-dev branch instead (closes #21421).

Discussion
----------

Use proper error message when session write fails #20807

This improves the error message that is thrown if a session write fails (see #20807)

As there was no way to get the actual handler, I introduced a method on the SessionHandlerProxy. I hope that's okay, otherwise please give me a hint on what to do.

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20807
| License       | MIT

Commits
-------

c7a44be Use proper error message when session write fails #20807
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) HttpFoundation
Projects
None yet
Development

No branches or pull requests

5 participants