List Info

Thread: Session usage/issues




Session usage/issues
user name
2006-10-21 21:37:53
Gloria wrote:
> So, somewhere in cherrypy, it's making HTTP wait
> for a response, and never responds but keeps runnning.
> The good news is that it is very easy to reproduce.

and I answered:
> If you could create a (hopefully small) demo of the
> problem and put it in a ticket, that would be a huge
help.

That would still be a nice thing, but I think the problem is
simply that os.unlink is being called on a file that doesn't
exist anymore. I don't mind ignoring the OSError that
results from that, but it would be nice to know why you want
this behavior so that can go in the docs for the change. Do
you have a separate process that is cleaning out session
files? Why do that instead of using the builtin cleanup
thread?


Robert Brewer
System Architect
Amor Ministries
fumanchuamor.org



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---
Session usage/issues
user name
2006-10-22 03:37:59
It would be great for cherrypy to handle this condition as
just a
nonexistent session.

My reason for this testing is to just make it bulletproof.
We'll be
installing this app on machines at law firms, where net
access to this
data from the outside is forbidden, and even physically
impossible. If
a client has this problem, I will not be able to fix it for
them. So I
must prove that cherrypy is "idiot-proof" to get
it approved as the web
framework of choice for the application I am designing.

If cherrypy cannot recover from a lost session file, it will
look
unstable to the client, and to the law firms's system
admins, who are
wondering why such a seemingly simple problem causes a
failure. It's
not about proper use. It's about improper use, and
anticipating the
uninformed user/admin who may inadvertently clean up
everything they do
not understand.

Actually, I found with my test program that it only hangs if
I do an
internal redirect after removing the session file.

The test files:

default.conf
[global]
server.socket_port = 1111
server.thread_pool = 10
tools.sessions.on = True
tools.sessions.storage_type = "file"
tools.sessions.storage_path = "./SessionData"
tools.sessions.timeout = 60

[/static]
tools.staticdir.on = True
tools.staticdir.dir =
"/usr/local/http/2.0.59/htdocs_ssl"


session_test.py:
import cherrypy
TemplatePath='./Templates'

class Login:
        def index(self):
                dbname = cherrypy.session['session_data'] =
"test"
                ft=open(TemplatePath + '/login')
                showPage=ft.read()
                ft.close()
                return showPage
        index.exposed = True

        def login_resp(self):
                try:
                        sdata =
cherrypy.session.get('session_data')
                        if not sdata:
                                raise
cherrypy.InternalRedirect(TemplatePath + '/')
                                #return "No session
file!"

                except (TypeError,KeyError,IndexError):
                        raise
cherrypy.InternalRedirect(TemplatePath +
'/')
                        #return "No session data!"
+
Handy.get_a_traceback()

                return "Found session data: %s" %
sdata
        login_resp.exposed = True

if __name__ == '__main__':
        cherrypy.tree.mount(Login())

        import os.path
       
cherrypy.config.update(os.path.join(os.path.dirname(__file__
),
'default.conf'))
        cherrypy.server.quickstart()
        cherrypy.engine.start()

Templates/login:
<center>
<h3>Just click this button:</h3>
<form action="login_resp"
method="post">
    <br><input type="submit"
value="Login"/>
</form>
</center>
SessionData/* starts out empty

To reproduce:

Run session_test.py , click on the html button to create a
session
file.
Remove the session file, and refresh the output page. Notice
that it
hangs.
Kill it, and uncomment out the return statements, comment
out the raise
cherrypy.Internalredirect() statements.
Rerun session_data.py. Notice that it no longer hangs.

Is there something wrong with my InternalRedirect syntax?


Thank you,
Gloria


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Session usage/issues
user name
2006-10-22 05:20:35
Ok, to clarify, I've narrowed it down to just redirection:

i_redirect.py:
import cherrypy

class Login:
        def index(self):
                raise cherrypy.InternalRedirect('/blah')
        index.exposed = True

if __name__ == '__main__':
        cherrypy.tree.mount(Login())

        import os.path
       
cherrypy.config.update(os.path.join(os.path.dirname(__file__
),
'default.conf'))
        cherrypy.server.quickstart()
        cherrypy.engine.start()

This hangs all of the time.

Thank you in advance,
Gloria


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )