Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS: "ENOENT" warning messages with sessions

I'm using node with the express-session and session-file-store packages. The session data is stored as files in the root directory, using the session-file-store package. However, now my logs are being clogged because the message [session-file-store] will retry, error on last attempt: Error: ENOENT, open 'sessions/_jl2ijMBQHIvv8M1mYTcnFZGqwGo0t-v.json' is appearing 5 times per session cookie accessed in a short burst. What could be causing this error? It's happening both on my windows development machine and on my ubuntu server. It can't access the file apparently, but the sessions still work.

Here is one of the bursts of errors I received:

[session-file-store] will retry, error on last attempt: Error: ENOENT, open 'sessions/tRI6WeZEO2Uyvr4ZaUGW6_CU32RjvFpW.json'
[session-file-store] will retry, error on last attempt: Error: ENOENT, open 'sessions/tRI6WeZEO2Uyvr4ZaUGW6_CU32RjvFpW.json'
[session-file-store] will retry, error on last attempt: Error: ENOENT, open 'sessions/tRI6WeZEO2Uyvr4ZaUGW6_CU32RjvFpW.json'
[session-file-store] will retry, error on last attempt: Error: ENOENT, open 'sessions/tRI6WeZEO2Uyvr4ZaUGW6_CU32RjvFpW.json'
[session-file-store] will retry, error on last attempt: Error: ENOENT, open 'sessions/tRI6WeZEO2Uyvr4ZaUGW6_CU32RjvFpW.json'
like image 875
terpak Avatar asked Jul 13 '15 15:07

terpak


1 Answers

So I literally just ran into the same messages when I was trying my first NodeJS/Express Sample Project out.

I managed to determine that at least in my sample project that the Session is Declared Destroyed but the Cookie never cleared, so the next page that loaded used the old cookie to try and access the expired session (already deleted) causing the messages to get logged.

This might not be the same issue for you, but figured it was worth sharing... The lazy alternative is to replace the logFn option with an empty function:

new filestore({logFn: function(){}})
like image 157
Futile32 Avatar answered Sep 28 '22 04:09

Futile32