Redis/Haproxy issue - php

We just switched our one of our php project to use Redis/Haproxy as solution for storing session. The issue we are facing is once in one or two months, the project will randomly lost session. We have to refresh the same page 10~30 times to see that issue. If we restart Haproxy, it seems working again. But, we don't want our client to experience same issue every couple weeks. Is there any thing I should pay attention to?

Related

Find intensive queries/pages sitewide with laravel

My website is build with Laravel and for the most part, works perfectly fine. However, there is an occasional issue where the website comes to a complete stop and page loading takes almost 5+ minutes. I have had this issue previously and it was because there was page on the website that was performing a loop of thousands and thousands of queries depending on what the user inputted into a form. If the user entered the number 5,000 then the page would perform 5,000 queries. Once I fixed that then everything was working perfectly again. I have my suspicion that something similar has happened again however I'm having trouble pinpointing exactly what could be causing it.
Is there anything that I can do, site-wise, to monitor this and help me locate the issue? Perhaps there is something that can be done on the operating system itself (I'm using Ubuntu)? It would be great if there was some monitoring system that allowed me to see which pages took the longest to complete all of its queries to the database.
Thank you.
If you want to track all queries/events/errors for all users with traces etc. then maybe
Laravel Telescope
is what you want. It is an UI for inspecting and debugging everything in Laravel. If your Laravel version is above 5.7.7 you can install it right away

Cant login in prestashop v1.6.1.4 backend (admin) site

If i try to login to the backend the site redirects to the login page. No error is shown.
The issue is similar to this post: Prestashop cant login in admin
But none of the solutions helped and are for an earlier version of Prestashop.
The problem seems to be sort of random or with multiple causes.
1) If i clear all the cookies, some times starts to work again, but then start fail again. Other times i clear the cookies and it doesnt help.
2) Some times it fails for http:, but it works for https. Some times it doesnt work for https neither.
3) Some times it works from IE, but not from chrome. Some times neither by IE. Same happens if i try by Chrome private mode.
Previous to this problem:
1) I updated all the modules. (I didnt reverted this becouse it is complicated)
2) i incremented the memory_limit and the max_time_execution in php configuration. (I reverted this but it didnt help)
Also, maybe is related or maybe not, but previous to this problem when i tried to save a product modification some times it didnt save and redirects to product edit page. This is also random, maybe after 2 attemps work, some times after 3 attemps.
As mentioned by PrestaAlba it is related to a bug caused by an update in recent browsers. Getting Rid of Synchronous XHRs, Synchronous ajax requests are now blocked by a majority of browsers.
You then have 3 choices to solve this:
You can download an older version of your browser
You can upgrade to the latest version of Prestashop (as mentioned by PrestaAlba)
You can apply the modification in this Pull Request to your store without having to upgrade Prestashop.
Update to last 1.6 stable Prestashop version. There is a bug related with web browsers updates that it fixed from Prestashop 1.6.10 version on.
Good luck.

Session handling in PHP and Zend

I got a really strange problem in my PHP webapp.
If I log in, everything works fine for the duration of my session.
If I come in the next day, my webapp returns me to the Login page (as I expect).
The problem is that once I log in, parts of my site work and parts don't. The parts that don't return strange error messages and then I'm logged out and need to log back in. The strange thing is that some days some parts don't work and other days other parts don't work. If I delete all cookie values I can see, that doesn't solve the problem. The problem is only solved by deleting the entire cookie itself and then logging in again.
I've turned off garbage collection (because on Ubuntu there is supposedly a cron job which does it automatically even though I can't see it) but the issue was occurring before that.
So in terms of simplicity my intention is two-fold:
- To add code to my Login page to delete the cookie entirely (assuming I can do that from PHP)
- To move session storage from my webserver to my MySQL DB (because I'm in my dev environment but preparing to build my test environment which will be a cluster of webservers, not just one)
My questions are:
- Is there any way to ensure session values die reliably and gracefully rather than lingering and wreaking havoc?
- Is it possible to delete an entire cookie from PHP code, rather than just cookie values?
Many thanks.
After being a constant problem for a while, this issue has gone away. I've actually determined the cause and so I thought I'd post a quick update. Basically I had three sites I was accessing on my domain, my own webapp, a CMS Admin page and another admin tool. I've determined that the session cookies between my webapp and CMS admin were interfering with each other. If I use different browsers to access the different sites, the problem doesn't reoccur. It was driving me up the wall. Thanks to those who posted suggestions/responses. I appreciate it. I'll mark this as closed.

Joomla Session Automatically Logs Out, No Content

I am running a Joomla 1.6 site, which I recently moved to a new server. I moved the site file system using rsync, and I replicated the MySQL database using MySQL utilities. The previous server has running Ubuntu server 10.10 and the new one is Ubuntu Server 11.10. Everything seems to be working correctly, except one thing...
In the site configuration, a user's session is set to expire after 24 hours. On the previous site it had been working correctly. On this new site, I have found that after a user logs in successfully and uses the site for some time, the user is logged out intermittently (randomly?), well before 24 hours, and then upon logging back in to the site (even in the back-end) the site is completely blank. The main menu is not there and there is no content. The logout button still appears, however, and the main banner. If the user logs out and then logs back in, usually all the content appears again like it should, and the site continues to function properly until the next time the session is booted.
Does anybody have any experience with this? Is there a place a can start debugging to find out why the session is ended abruptly? Why can I log in to the site and still not see any content?
I share the same issue. Being logged out, then logging back in and seeing nothing.
It is very random, and will happen 10 times in a row, or never for two weeks.
This happens on a site that's quite complex (plenty of extensions), and has some traffic (5000 hits/day + 100 admin access / day) on J. 1.7
There is obviously something wrong with the session management.
In an attempt to make the site faster we have tweaked the database and moved the session table to memory, and I believe this may be the key aspect here.
Once we had repeated errors happening and clearing the sessions table solved it (until the next day), so I would guess it's connected to the in-memory sessions table.
If your table is in memory, try moving it to disk; if it's not, try emptying it and see if it happens again, and post back! Good luck
More news.
After long debugging the issue was related by an exception in the core which was not properly handled (related to saving an item with a duplicate alias, i.e. saving a second article in the same category with the same title/alias).
For us it was enough to migrate to J 2.5.3 to solve the issue.
Anyway, as a general comment, such behaviour could be related to an error in some Joomla files, which should leave traces in your error_log (else enable error logging).
It took my customer 3 months to understand what they were doing and describe it so finding an error might speed up the diagnostics.

CodeIgniter losing session information

I have a CI app that uses db sessions, and a few hundred users on at any one time.
Sessions work perfectly for everyone, except one guy, who keeps getting booted back to the auth/login controller after a few actions. It seems that clearing his cache works for a few days, but the problem then comes back.
As far as I am aware, he is the only user with this problem. Even his business partner sits next to him on a different pc and does not suffer the same problem.
Apparently he is using IE (8 or 9, cant remember which). I asked him to try chrome or FF, which he has said gives the same problem. I’m not sure if he actually has tried them or not…but I can’t exactly argue with the guy.
Needless to say, the guy is pretty pissed off and ready to throw his pc out the window…or perhaps at me.
Any ideas on what to do or suggest here?
In the end, it seems that this was caused by the user being on a USB mobile dongle. Same laptop on a wireless network worked fine. Go figure.

Categories