[dancer-users] Debugging sessions

Zahir Lalani ZahirLalani at oliver.agency
Wed Nov 21 18:16:37 GMT 2018


Nik

We have the same issue - we have multiple servers and hundreds of logins per day. We believe something is killing a starman worker and then that user gets bounced to another server and so loses the session. We are trying to check logs to see what errors would lead us to the issue but no luck yet - we have to schedule a restart when we begin to run low on active workers

Z

> -----Original Message-----
> From: dancer-users <dancer-users-bounces at dancer.pm> On Behalf Of Nikola
> Mitev
> Sent: 21 November 2018 17:17
> To: dancer-users at dancer.pm
> Subject: [dancer-users] Debugging sessions
> 
> Hi all,
> 
> I have an annoyingly intermittent problem where on successful authentication
> the session info disappears and the user is endlessly redirected to the login page.
> It happens about once a month on a site with 10-20 logins daily. Once it happens
> to a user, it keeps happening for that user only. A restart of the app usually fixes
> the issue, and I am yet to see someone who had this problem to report it again
> at a later stage. Had about 10 cases so far in total.
> 
> The cookie is generated on accessing the login page, stored in the browser and
> sent with the login POST request so I can verify cookies are enabled. The user is
> then authenticated, data added to the session including an 'authenticated' flag
> and they are redirected to their dashboard. Right before the redirection the
> session data is present.
> They make a request for the dashboard following the redirect, this triggers a
> session authenticated check which fails as no data is available for the session.
> They are then redirected for authentication and so on in a loop. If I restart the
> app the issue vanishes.
> 
> hook before => sub {
>     # <snip>
>     if (!session('authenticated')) {
>         forward '/login';
>     }
> }
> 
> post '/login' => sub {
>      # user authentication and session storage here, then the debug
> code and the redirecton:
>      my $authenticated = session('authenticated');
>      $log->info("User authenticated ($authenticated), redirecting to
> $target_route");
>      return redirect $target_route;
> };
> 
> I don't have an explicit check on cookie size - not sure how to check it doesn't
> exceed 4K - but find it unlikely this is the issue. If that was the problem it should
> be happening persistently for a user regardless of restarts etc?
> 
> Hope all this makes sense, I am looking for general advice on how to
> troubleshoot this but any ideas at all will be very much appreciated.
> 
> Nik
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users


More information about the dancer-users mailing list