Giter Club home page Giter Club logo

Comments (9)

colinmollenhour avatar colinmollenhour commented on July 21, 2024

I have not experienced such an issue.. I am using PHP 5.4 though. Are you using the phpredis extension or standalone? Whichever you are using try the other and see if that makes a difference.

You might try giving persistent connections a try, they work well for me.

from cm_redissession.

MattSenter avatar MattSenter commented on July 21, 2024

I too have encountered this. Maybe I can add a little more info. We are doing a call to a Magento API endpoint (fetch catalog,) and a session is being created and written to Redis, but later in that same call, it is attempting to write the session to Redis a second time, and I was noticing on the README that "Only one process may get a write lock on a session." If that's the case, what would you suggest be done to satisfy that second write attempt? (If you're curious, it's happening when a product is loaded and then getPriceData() is called. Seems to be unavoidable from the Magento side of things.)

from cm_redissession.

colinmollenhour avatar colinmollenhour commented on July 21, 2024

Thanks for the additional info. I seem to recall that the price models depend on the customer session (due to getCurrentCurrency or similar method), which I would definitely consider to be a bug (models should never interact with sessions). I think my solution was to set the currency explicitly so that it wouldn't try to load the session. However, Cm_RedisSession uses a flag to make sure the session is only written once, so the only way this could be an issue is if somehow Magento tried to open the same session twice in one request which would be really weird.. I have noticed other bugs in the Magento API (api_session rows with NULL session ids, etc..) so it is an all-around mess (haven't looked at newer versions but I assume they are the same).. Sorry I'm not more help.. I'd be happy to consider any solution you want to propose/implement.

from cm_redissession.

MattSenter avatar MattSenter commented on July 21, 2024

Yep, it definitely looks like it's trying to create the session twice. Coz I can peek in Redis and see the session key when the api is first called, and then later in that same call, this Mage_Catalog_Model_Resource_Product_Collection.addPriceData() mess is taking its own stab at a new session. It's gotta be the locking then, I suppose, because that would be the only thing I can see different from other systems not using Credis+Redis for session storage. Shouldn't it fall back, though? Why am I getting the error and not getting a fallback to MySQL or file session, I wonder? Frankly, the session that addPriceData() is trying to create is pointless, so if I just had a way to react as if the error was inconsequential, that would probably be fine.

from cm_redissession.

MattSenter avatar MattSenter commented on July 21, 2024

Actually, I think I got that wrong. It's the initial api login that may be creating the successful session I see in Redis, and a subsequent separate call that performs the actual catalog api fetch with my newly established sessionId that is resulting in the failed creation of a second session in the 'customer_admin' namespace when the product collection is loaded. So, the second session creation attempt is in a completely new, authenticated request...and it fails seemingly because it can't connect to Redis...but Redis is there.

from cm_redissession.

colinmollenhour avatar colinmollenhour commented on July 21, 2024

The Magento API code itself actually never instantiates a real session and instead it just does it's own verification of the session variable passed to the "call" method (using api_session table). It is really a terrible design to use these "pseudo sessions" but then at the same time actually instantiate a cookie-based session to store things like the current store id..

I honestly have no idea why this would cause connection issues though.. I'm on the fence as to if a fallback is even a good feature to have since it creates a "split brain" scenario..

Whatever the reason for the connection failure, once the backend fails a connection the redis mode is disabled entirely. One place to start debugging would be to find out why the first session is getting instantiated as there really should be no sessions with the Magento API.

from cm_redissession.

MattSenter avatar MattSenter commented on July 21, 2024

there really should be no sessions with the Magento API

That was my first assumption, which is why this has been such a surprising issue. However, even if I am able to stop that initial successful session from being created, there doesn't appear to be any way around the creation of that second session simply because of where it lies (i.e. in an observer that fetches additional price data for the collection of products that was just loaded.)

once the backend fails a connection the redis mode is disabled entirely

For the scope of the request?

from cm_redissession.

colinmollenhour avatar colinmollenhour commented on July 21, 2024

Yes, the _useRedis flag is set to false on the connection failure. Once set no further connection attempts are made. Unless the model is instantiated twice somehow..

from cm_redissession.

csdougliss avatar csdougliss commented on July 21, 2024

Still seeing this again. What's strange is that it doesn't happen on the other node (I have 2 load balanced)

REQUEST: -
TIME: 2.547237s
ADDRESS: 195.26.57.129, 10.189.247.3
USER AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36
FILE: 20140827082445/app/code/core/Mage/Core/functions.php:247
Warning: Failed connecting to redis server at IP: Connection timed out  in  on line 0
2014-08-28T08:50:18+00:00 EMERG (support_portal_uk): /turpentine/esi/getBlock/method/esi/access/private/ttl/14400/hmac/b538b0ba003d40f2d3bf8d88d60193b4b6442b38cbba904ba642d77eb4ca9c44/data/sD8L8aozh48XriEcCgaAzJkeWE0jOLuShD-dcl4K7X3.xhvYQYnb4HRK2CIVhRrjl3Kf4RqutHmvTUczLfb9atfhSFDCpuudWbYiipLuaCk51ZJ8qI2Q6JpIoYco--O4CQoa9aMLr6RfvKwQVPVFG2TVMoQKOe.uzjKXpW6U8fEOixgIFSitYbUAovDHAUJG70YRGvnHMIyBbBIIJEPSQitY9MpjTNxOjudMA3wnIzqwqsb4xyKUDiAo1jIkcHJq.fm-A5o1NLJREk5fniU2ERuuGOzX3brDq3QdAnbsMXtGfcA99gPNruGPWlUpzXle7gs.fzV5kWLqWATshjPvsrut4Slf-xz5IijWICIXI7-Ld4cDR3C507h.fZdkDYjBI8zRQ.F3-FDTBjiSqwIVX-dJOaWwFGL3mjzunwp4EAkPtYdAwromNA==/ 
REQUEST: -
TIME: 2.548516s
ADDRESS: 195.26.57.129, 10.189.247.3
USER AGENT: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36
FILE: 20140827082445/app/code/community/Cm/RedisSession/Model/Session.php:176
Unable to connect to Redis; falling back to MySQL handler
2014-08-28T09:34:55+00:00 ERR (vax_es_default): / 
REQUEST: -
TIME: 2.535395s
ADDRESS: 10.189.246.7
USER AGENT: HTTP-Monitor/1.1
FILE: 20140828090336/app/code/core/Mage/Core/functions.php:247
Warning: timed out after 2.5 seconds when connecting to IP [110]: Connection timed out  in  on line 0

from cm_redissession.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.