-
Notifications
You must be signed in to change notification settings - Fork 375
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
Session slice stops accepting new items #109
Comments
Are you using the CookieStore? Check the error from session.Save - you
might be hitting the 4KB size limit of a cookie.
…On Mon, Mar 27, 2017 at 4:54 AM ekkapob ***@***.***> wrote:
Are are any limit to the session? I have code below to append a new item
to the slice. It works many items until some point I can't retrieve the new
item data, like it stops accepting the new item after save.
I tried to print out the session store after session.save the data are in
there. But in another handler, it can't see the new item. I registered all
of the structs with gob, still not working. I have no clue because it
works and then stop working like the session doesn't accept the new slice
item, but editing the existing value still works.
// item.List = []Item
item.List = append(item.List, Item{name: "abc"})
session["items"] = item
session.save(r, w)
// print here shows the new added item
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#109>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABIcMVYBIFqwqsnf33lOeOqzyD_lD1Mks5rp6NrgaJpZM4MqKUe>
.
|
@elithrar thank you! you are right the error says |
- If you increase the MaxLength for the CookieStore, browsers will not
accept your cookie - the typical max size per domain is 4KB.
- You can use the FilesystemStore instead, or one of the many third party
stores (https://github.com/gorilla/sessions#store-implementations) - the
Redis one being my personal go-to - but I would sanity check the rationale
for storing > 4KB per data per session as well.
…On Mon, Mar 27, 2017 at 7:22 AM ekkapob ***@***.***> wrote:
@elithrar <https://github.com/elithrar> thank you! you are right the
error says securecookie: the value is too long
With this, does the only option I have is using FilesystemStore instead
with increase MaxLength? Checked with the session but not found any option
to increase the size.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#109 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABIcGQIONEPjAwOXYHcoQuOUDtJOTZjks5rp8YVgaJpZM4MqKUe>
.
|
Thank you @elithrar for the answer and advice. I end up do the checking and warn the user as they shouldn't keep adding (temporary) things. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are are any limit to the session? I have code below to append a new item to the slice. It works many items until some point I can't retrieve the new item data, like it stops accepting the new item after
save
.I tried to print out the session store after
session.save
the data are in there. But in another handler, it can't see the new item. I registered all of the structs withgob
, still not working. I have no clue because it works and then stop working like the session doesn't accept the new slice item, but editing the existing value still works.but another handle doesn't see the new added item.
The text was updated successfully, but these errors were encountered: