Skip to content

Starcounter.Authorization should not create Starcounter.Session unless required #91

@miyconst

Description

@miyconst

It turns out that Starcounter.Authorization will create new Starcounter.Session for every request, even if it's a simple REST API request.

This is very inefficient, because every REST API request would create a new Starcounter.Session which won't be used any more, but will consumer resources and eventually die with a timeout.

This session spawn leads to the following exception under high load of REST API.

"System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: No free session indexes left.
   at Starcounter.Internal.SchedulerSessions.CreateNewSession(ScSessionStruct& ss, Session publicSession, UInt64 timeoutMinutes) in C:\    c_work\sc-19961\Level1\src\Starcounter.Sessions2x\SchedulerSessions.cs:line 112
   at Starcounter.Sessions2x.SessionFactory.Create(Session publicSession, ScSessionStruct& sss) in C:\    c_work\sc-19961\Level1\src\Starcounter.Sessions2x\SessionFactory.cs:line 20
   at Starcounter.Internal.XSONSessionDependencies.SessionFactoryWithSchedulers.Create(Session publicSession) in C:\    c_work\sc-19961\Level1\src\Starcounter\Apps\XSONDependencies.cs:line 93
   at Starcounter.Session..ctor(Flags flags, Nullable`1 includeNamespaces) in c:\github\Starcounter.XSON\src\Starcounter.XSON\Sessions\Session.cs:line 184
   at Starcounter.Session.Ensure() in c:\github\Starcounter.XSON\src\Starcounter.XSON\Sessions\Session.cs:line 373
   at Starcounter.Authorization.Authentication.TicketCreationStartupFilter.<>c__DisplayClass2_0.<Configure>b__1(Request request)
   at Starcounter.Handle.RunRequestFilters(Request req) in C:\    c_work\sc-19961\Level1\src\Starcounter.Internal\Handle.cs:line 555
   at Starcounter.Internal.AppsBootstrapper.ProcessExternalRequest(Request req) in C:\    c_work\sc-19961\Level1\src\Starcounter.Apps.JsonPatch\AppsBootstrapper.cs:line 345
ParamName=No free session indexes left.
HResult=-2146233086
"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions