You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-user@tcl.apache.org by David McTavish <dm...@sandvine.com> on 2004/11/17 17:23:55 UTC

sessionContext::cset

Anybody know why setting session variables causes websh to hang?  This code has been running for nearly a year until it finally just stoppped working altogether. I've restarted apache, and I've even replaced the mod_websh.so file (in the hope that it might have become corrupted somehow). The line in question is as follows:
 
 sessionContext::cset isSessionStart true
 
I've even tried putting a catch around this to no avail. The perplexing part is that the code is able to set other variables using the same mechanism higher in the code.
ie: the first thing I do is as follows:
 
        sessionContext::cset isCookiesEnabled true
        sessionContext::cset isSent false
        sessionContext::cset isSessionStart false
        sessionContext::cset sid {}
        sessionContext::cset isSessionNew false
        sessionContext::cset sessionPath $repositoryPath
 
I then check the users' cookie session, and update some of the sessionContext variables as appropriate.
 
        if {! [sessionContext::cget isSessionStart] } \
        {
            # check if pre-existing session in cookie
            web::cookiecontext cookieSession -path "/" -secure false
            cookieSession::init svreports
            set qsid [getQueryStringValue "sid"]
 
            if { [cookieSession::cexists sid] } \
            {
                sessionContext::cset isCookiesEnabled true
                set sid [cookieSession::cget sid]
            } \
            elseif {![string equal $qsid {}]} \
            {
                set sid $qsid
                createNewSession $sid
            } \
            else \
            {
                set sid [generateSessionID]
                createNewSession $sid
            }
            if {$sid == {}} \
            {
                # cookie is invalid, no-op
            } \
            else \
            {
                initializeFileSession $sid
catch {                sessionContext::cset isSessionStart true } e
web::put $e
                sessionContext::cset sid $sid
            }
     }
 
 
Any ideas?
 
thx,
d.

Re: sessionContext::cset

Posted by Peter Kohler <pe...@netcetera.ch>.
Hi David,

> Anybody know why setting session variables causes websh to hang? 
> This code has been running for nearly a year until it finally just
> stoppped working

...do you run the application on an NFS file system by any chance?
I once run into a similar problem, when the security department turned
off the 'lockd' on the NFS server. This caused websh to hang when
accessing/creating state files, due to a blocking 'flock()' system
call.

...just an idea...

regards

Peter

------------------------------------------------------------------------
Peter Kohler                                   peter.kohler@netcetera.ch
Netcetera AG, 8040 Zuerich    phone +41 1 247 79 03  fax +41 1 247 70 75


---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org


Re: sessionContext::cset

Posted by Aleksandar Nikov <an...@netcetera.com.mk>.
Hi David,

Could you also post the code for initializing the sessionContext, as well 
as procedures createNewSession and initializeFileSession?

Regards,
Alex


> Anybody know why setting session variables causes websh to hang?  This code has been running for nearly a year until it finally just stoppped working altogether. I've restarted apache, and I've even replaced the mod_websh.so file (in the hope that it might have become corrupted somehow). The line in question is as follows:
>  
>  sessionContext::cset isSessionStart true
>  
> I've even tried putting a catch around this to no avail. The perplexing part is that the code is able to set other variables using the same mechanism higher in the code.
> ie: the first thing I do is as follows:
>  
>         sessionContext::cset isCookiesEnabled true
>         sessionContext::cset isSent false
>         sessionContext::cset isSessionStart false
>         sessionContext::cset sid {}
>         sessionContext::cset isSessionNew false
>         sessionContext::cset sessionPath $repositoryPath
>  
> I then check the users' cookie session, and update some of the sessionContext variables as appropriate.
>  
>         if {! [sessionContext::cget isSessionStart] } \
>         {
>             # check if pre-existing session in cookie
>             web::cookiecontext cookieSession -path "/" -secure false
>             cookieSession::init svreports
>             set qsid [getQueryStringValue "sid"]
>  
>             if { [cookieSession::cexists sid] } \
>             {
>                 sessionContext::cset isCookiesEnabled true
>                 set sid [cookieSession::cget sid]
>             } \
>             elseif {![string equal $qsid {}]} \
>             {
>                 set sid $qsid
>                 createNewSession $sid
>             } \
>             else \
>             {
>                 set sid [generateSessionID]
>                 createNewSession $sid
>             }
>             if {$sid == {}} \
>             {
>                 # cookie is invalid, no-op
>             } \
>             else \
>             {
>                 initializeFileSession $sid
> catch {                sessionContext::cset isSessionStart true } e
> web::put $e
>                 sessionContext::cset sid $sid
>             }
>      }
>  
>  
> Any ideas?
>  
> thx,
> d.
> 

------------------------------------------------------------------------
Aleksandar Nikov                                 anikov@netcetera.com.mk
Netcetera Engineering                             phone +389 2 30 64 532
1000 Skopje, Macedonia                              fax +389 2 30 79 495


---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org