8000 PDO session timestamps out of range for postgres · Issue #24456 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

PDO session timestamps out of range for postgres #24456

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
mxp100 opened this issue Oct 6, 2017 · 6 comments
Closed

PDO session timestamps out of range for postgres #24456

mxp100 opened this issue Oct 6, 2017 · 6 comments

Comments

@mxp100
Copy link
Contributor
mxp100 commented Oct 6, 2017
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 2.6+

With using PDO session handler with Postgres: PDO SQL error in PdoSessionHandler->close() - integer out of range, if gc_maxlifetime in php.ini with default value.

@Tobion
Copy link
Contributor
Tobion commented Oct 6, 2017

What does your schema look like?

@Tobion
Copy link
Contributor
Tobion commented Oct 6, 2017

It works on sqlfiddle. http://sqlfiddle.com/#!17/52d8c/2
So how to reproduce the problem?

@mxp100
Copy link
Contributor Author
mxp100 commented Oct 12, 2017

insert into sessions values ('abc', 2147483647, 1440);
DELETE FROM sessions WHERE ses_lifetime + ses_time < 1509428343;
select * from sessions;

@mxp100
Copy link
Contributor Author
mxp100 commented Oct 12, 2017

ses_lifetime = 2147483647 and you reproduce problem

@Tobion
Copy link
Contributor
Tobion commented Oct 12, 2017

That's just the standard https://en.wikipedia.org/wiki/Year_2038_problem hit now if you use big lifetimes. So the proper fix might to use bigger integer column. As your solution will give you another 20 years to hit the problem again, it's better than nothing. ;)

@mxp100
Copy link
Contributor Author
mxp100 commented Oct 13, 2017

it's standard practice for unlimited sessions

fabpot added a commit that referenced this issue Oct 16, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

pdo session fix

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #24456
| License       | MIT
| Doc PR        |

Fix PDO session timestamp out of range for postgres. (branch from 2.7)
P.S. please delete this pull #24457

Commits
-------

56b29a7 pdo session fix
@fabpot fabpot closed this as completed Oct 16, 2017
tanasecosminromeo added a commit to tanasecosminromeo/symfony that referenced this issue Jan 25, 2018
…n Pdo driver

The initial fix for symfony#24456 was wrong, since it only accounted for Postgres. @WhiteEagle88 correctly identified symfony#25665 - but having time as SIGNED is ... off, since time shouldn't be negative. Using CAST to solve this issue surely has a performance penalty, so I believe the best approach is to have a switch based on the driver.
fabpot added a commit that referenced this issue Jan 29, 2018
…ed on Pdo driver (tanasecosminromeo)

This PR was submitted for the master branch but it was squashed and merged into the 2.7 branch instead (closes #25922).

Discussion
----------

[HttpFoundation] Use the correct syntax for session gc based on Pdo driver

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #25665 #24456
| License       | MIT
| Doc PR        |

The initial fix for #24456 was wrong, since it only accounted for Postgres. @WhiteEagle88 correctly identified #25665 - but having time as SIGNED is ... off, since time shouldn't be negative. Using CAST to solve this issue surely has a performance penalty, so I believe the best approach is to have a switch based on the driver.

Commits
-------

826dfbd [HttpFoundation] Use the correct syntax for session gc based on Pdo driver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0