Whenever a user connect to the application after a very short period of time (like 2 or 3 minutes) he gets logged out from the application.
I thought it's the session's lifetime that being very short so I have increased it in the config.yml file like this:
framework:
session:
cookie_lifetime: 7200
But still the same problem.
The application works fine on locahost but I face this when it's running remotely!
Is there anything I should be aware of to fix this issue?
Check your session.cookie_lifetime in the php.ini file of your remote server, I'm not sure but it may override the parameters in Symfony.
After you change it, don't forget to restart php so the change is taken into account.
Related
When the user uses my symfony application, then after a couple of minutes the user is automatically logged out, while he is working with the application. To prevent that I changed in
config/packages/framework.yaml
framework:
session:
cookie_lifetime: 86400
gc_maxlifetime: 1800
This means the cookie lifetime is set to 24 hours. So I expect the user will only be logged out when he closes the browser. But in reality he is still automatically logged out after half in hour or so. What other options can I try?
Did you try to unset gc_maxlifetime ? It seem that PHP clear the session after this time. Moreover it's 30 minutes lifetime like your logged out problem.
framework:
session:
cookie_lifetime: 86400
You should definitively don't set gc_probability to null otherwise PHP won't ever clean your "dead" session and your server will be lack of disk space after a time.
Also it can be worth it to have a look to your php.ini configuration values because PHP will take them if they aren't specifid in Symfony configuration.
In other words Symfony override your PHP configuration if you specify somes configurations (there is a list of them )
I have a medical management created with Symfony 2.8 that at random time (from customer's email text) logout users after a bit of inactivity (this happen when they send a form (whatever it is)).
I have already increased the session time bringing it up to seven months.
The cache_lifetime is set to 0 ("when close your browser").
I have have tried to recreate the problem but neither me neither my collaborator have found the problem (never logged out).
Is there a way to figure out why the system logged out users or a function / controller / event to be called when there is automatic logout so that I can understand what the browser customer does ?
It is most likely your server that times out the session and not Symfony.
Anyways the best way (imo) to make sure you keep sessions in a Symfony app is to store them in the database.
# app/config/config.yml
framework:
session:
# ...
handler_id: session.handler.pdo
services:
session.handler.pdo:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
public: false
arguments:
- 'mysql:dbname=mydatabase'
- { db_username: myuser, db_password: mypassword }
Full doc article: http://symfony.com/doc/current/doctrine/pdo_session_storage.html
We have a site with Symfony2 with some traffic.
Every day the site begins to fail with this error for 1 or 2 minutes (15-20 errors). This occurs at random hours, could not find a pattern. It does not fit even to peak hours.
2015-10-09 02:23:57.635 [2015-10-09 06:23:38] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Failed to start the session" at /var/www/thing.com/httpdocs/app/cache/prod/classes.php line 121 {"exception":"[object] (RuntimeException(code: 0): Failed to start the session at /var/www/thing.com/httpdocs/app/cache/prod/classes.php:121)"} []
Doesn't seem to be a double header problem or double start problem.
Site does not interact with any PHP legacy code that could be messing with the sessions.
Sessions are stored in the database so a file problem is discarded.
Lowered the session duration so the session table does not get too big and the problem persists.
Think It could be a problem with HWIOAuthBundle and it's facebook login, but cannot find where is the conflict.
Also the site uses a lot of render_esi for caching with Symfony2 internal cache system.
Update -------------------------------------------------
Emptied the /var/lib/php/sessions folder of older session files than were not being used.
Lowered the session lifespan. Sql entries in the sessions table went from ~3 Million to ~1.3 Million.
Seems that the problem is gone but this is not a real solution.
My guess is that the pdo_handler in symfony2 has a performance problem.
Maybe someone with more knowledge in this matter (pdo_handler, table optimization) can point a real solution for high traffic.
Where does your PHP installation save sessions to?
[You can find this in your php.ini file in the session.save_path setting, assuming you have CLI access]
It is very likely PHP uses your servers /tmp folder. If this folder is full at any point, then PHP can't create new sessions.
You can see the current size of your /tmp folder with:
du -ch /tmp/ |grep total
If, as is common, the /tmp folder is on its own partition, you can see its maximum size with :
df -h
Some programs can suddenly guzzle Gbs of this folder for their purposes.
i can't seem to find the solution on how to disable auto logout after inactivity? Id like the sessions to stay alive until the browser window is closed.
Is it just the the session: config in the config files that is causing the logout or is it some FOSUSerBundle config i cannot seem to find??
Have you tried to set the sesion life time like this:
framework:
session:
cookie_lifetime: 60 #60 seconds
gc_maxlifetime: 50 #50 seconds - only needed for testing. Dont use this in a production environment
gc_probability: 1 #only needed for testing. Dont use this in a production environment
gc_divisor: 1 #only needed for testing. Dont use this in a production environment
Complete code: https://reformatcode.com
Log Name: System
Source: Microsoft-Windows-WAS
Date: 13.06.2012 08:34:45
Event ID: 5002
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: WIN-QU022VN756J
Description:
Application pool 'DefaultAppPool' is being automatically disabled due to a series of failures in the process(es) serving that application pool.
Please provide near solution for this problem. I will appreciate the suggestion
IIS comes with a feature called Rapid-Fail Protection. By default an App Pool is configured to become disabled if a worker in the pool crashes 5 times within a 5 minute span.
The thresholds of this setting are able to be modified by right clicking on the App Pool going to Advanced Settings and modifying the 'Rapid-Fail Protection' properties. However, this event indicates that there is likely a serious issue in your application that needs to be resolved.
I got tensed about this issue and finally i got solved.
Please make sure that the following option is correct in Advance Settings in Application pool.
Application Pools>Default Application Pool > Right click and select Advance Settings.
And then check whether the option "Enable 32 bit applications" has been set as "False". It should be False
I got solved by did the above change.
I Got this error when i installed URL Rewrite Module, install correct URL Rewrite Module to fix this.
To verify this error cause of URL Rewrite Module check events logs .
windows logs>> System>> Click on recent Error, In Error details
it will show "Application pool 'DefaultAppPool(or
YourApplicationpool)' is being automatically disabled due to a
series of failures in the process(es) serving that application
pool."
Windows logs>> Application>> click on recent error, In error
details it will show "The Module DLL
'C:\Windows\system32\inetsrv\rewrite.dll' failed to load. the data
is the error."
I hope this will help You.
It's a registry permission issue. This should help:
http://support.microsoft.com/kb/885654
You might also need to add read/write permissions for NT AUTHORITY\NETWORK SERVICE (or NT AUTHORITY\SYSTEM or the account used by your application pool) to c:\Windows\TEMP.
See http://social.technet.microsoft.com/Forums/en-US/winservergen/thread/176e9b6d-7b1b-4667-b55e-330bec133f37/