Task #8596 (closed)
@login_required to call conn.c.closeSession()
Reported by: | wmoore | Owned by: | cxallan |
---|---|---|---|
Priority: | critical | Milestone: | OMERO-4.4 |
Component: | Web | Version: | n.a. |
Keywords: | n.a. | Cc: | atarkowska, cneves |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | 0.0d |
Sprint: | 2012-05-08 (14) |
Description
Need to be sure we're not leaking connections.
E.g.
jrs-macbookpro-25107:OMERO will$ git diff diff --git a/components/tools/OmeroWeb/omeroweb/decorators.py b/components/tools/OmeroWeb/omeroweb/decorators.py index 3d6aa93..73b4884 100644 --- a/components/tools/OmeroWeb/omeroweb/decorators.py +++ b/components/tools/OmeroWeb/omeroweb/decorators.py @@ -273,7 +273,12 @@ class login_required(object): kwargs['conn'] = conn kwargs['conn_share'] = conn_share kwargs['url'] = url - return f(request, *args, **kwargs) + retval = f(request, *args, **kwargs) + try: + conn.c.closeSession() + except: + logger.error('Error while cleaning up connection.', exc_info=True) + return retval return wraps(f)(wrapped)
Change History (6)
comment:1 Changed 12 years ago by wmoore
comment:2 Changed 12 years ago by atarkowska
- Sprint changed from 2012-04-24 (13) to 2012-05-08 (14)
comment:3 Changed 12 years ago by cxallan
- Remaining Time set to 0.25
- Status changed from new to accepted
comment:4 Changed 12 years ago by cxallan
- Remaining Time changed from 0.25 to 0
- Resolution set to fixed
- Status changed from accepted to closed
Functionality now up on the 8596_connection_cleaning branch:
comment:5 Changed 12 years ago by Chris Allan <callan@…>
(In [d9d0f6dd2cfbf2940e0e65eb0b10f38d5289f24f/ome.git] on branch develop) Decorator extension to clean up the connection. (See #8596)
comment:6 Changed 12 years ago by Chris Allan <callan@…>
(In [5cb110571ac7599c8c8c8789992d00661f65d51c/ome.git] on branch develop) Utilise override in webclient view methods. (See #8596)
The change suggested above breaks methods where we pass the HttpResponse? a generator that needs the session to be open. E.g:
Instead of displaying the original file, I get