Sessions: Create a new Filesystem backed session if a match can't be found

Created on 30 Jan 2013  ·  7Comments  ·  Source: gorilla/sessions

I'm using the Filesystem session store, and emptied my session directory after creating a session to see what would happen. The log message looked like this:

2013/01/30 00:42:44 open /Users/gtaylor/Documents/workspace/gopath/src/monweb/sessions/session_5A5RY546OOHJUSK5DEVARK7LFUW2NRLCNMC2V2TS2AVQ4GB22ZBA: no such file or directory

Perhaps it would be a good idea to create a new session instead of a hard failure? This appears to currently be an unrecoverable error, since the user has a cookie set with the session ID, but the match always fails.

enhancement help wanted stale

Most helpful comment

I have a similar error (using MacOS 10.12.6):

remove /var/folders/1c/btjqtfcn1291_65wj5jphtg40000gn/T/session_: no such file or directory

I understand the suggestions OP and glaslos made; Just making a new session ID sounds best. What's the best way to do this? An example func would be appreciated.

All 7 comments

Still no way to handle this?

I'm certainly open to any help on this—extremely time constrained.

I ran into the same issue. Thought about it and concluded the current implementation is fine by me. By returning the error I can decide how I want to handle it: Create a new session with the same id? Create a new id? Return an error to the client? What if the client has changed the session id? Someone brute forcing session IDs? IMHO this is a wont-fix.

i dont understand: FilesystemStore save sessions to the file on client browser or in server directory?

@fardok the session and it's data is stored on the file system server side and on client side the session id in a cookie.

I have a similar error (using MacOS 10.12.6):

remove /var/folders/1c/btjqtfcn1291_65wj5jphtg40000gn/T/session_: no such file or directory

I understand the suggestions OP and glaslos made; Just making a new session ID sounds best. What's the best way to do this? An example func would be appreciated.

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marksalpeter picture marksalpeter  ·  17Comments

elithrar picture elithrar  ·  22Comments

luca-moser picture luca-moser  ·  3Comments

cless picture cless  ·  23Comments

CasperHK picture CasperHK  ·  11Comments