I'm not positive, but it should only be inserting sessions when a new one is created, correct? Maybe a new session is being created for the AJAX request, and if enough ajax requests hit the server fast enough, two sessions end up being created with the same ID. Something like this:
Request #1 is fired
Request #2 is fired
Request #1 hits the server, creates a new session with a "unique" ID
Request #2 hits the server, creates a new session with the same ID because that session file doesn't exist on disk yet
Request #1 saves the session to the file
Request #2 saves the session to the file, overwriting Request #1's session data
With DB sessions, this would cause a constraint violation because it would be inserting a second session row with the same ID as the first. I'm not sure about the solution though. I would have thought the session would start when you first hit the page, not when the first AJAX request is fired.
I used file driver, but this didn't help. I problem is with loosing all info from session.
Step 1 - add products to cart (gloudemans/shoppingcart)
Step 2 - by clicking save heading image and then big image. Also print color.
Step 3 - same as step 2 but with back side
Sometimes it's ok, but sometimes I loose session id (I think) and with this I'm loosing all data. If you have better idea to store this printing attr (color, images, font, ...). Should I create order with this in 1st step? And just updating model? (Session will be used for cart and order_id)