Skip to content

Don't document example code which causes memory leaks #741

Open
@spaceone

Description

@spaceone

The example sp-wsgi/sp.py stores the response.name_id which is a saml2.saml.NameID.
https://github.com/IdentityPython/pysaml2/blob/master/example/sp-wsgi/sp.py#L404-L405
https://github.com/IdentityPython/pysaml2/blob/master/example/sp-wsgi/sp.py#L335-L339

Holding this in memory between multiple requests bloats up the RAM / RS.
For 800 logged in users we have a lot stdlib instances, which partly belongs to/references this name_id object:

dict 7625
tuple 7113
list 6421

For a single core CPU running with cherrypy I come into performance problems when 4000 users are logged in. (Maybe because the garbage collector can't remove all objects fast enough?).

The problem got fixed when I simply don't store the NameId object but:

from saml2.ident import code
name_id = code(response.name_id)

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