Hello!

Sending a function to a session should work even if session is dead. I
think, there is a bug because of which this does not work in case of
internal event loop. Try to use "dialog->show()" way instead of
"dialog->exec" to avoid internal event loop.

By the way, deletion of WApplication can be delayed after closing
window (see wt_config.xml, timeout,
http://www.webtoolkit.eu/wt/doc/reference/html/overview.html#config_session
).

Related things:

1. If a function passed to post() is a slot of WObject, it is better
to wrap it with WApplication::bind(). In this case it will not crash
in case the WObject is deleted before the function is applied.

2. Are you using some kind of synchronisation when one client it is
getting control the radar and tells others about that? I mean, races
prevention. What will happen if two clients will try to get control at
one point of time?

On Thu, Nov 8, 2012 at 4:52 AM, Joseph VanAndel <vanan...@ucar.edu> wrote:
> I'm writing an application that controls a weather radar.  Only 1 user is 
> allowed to control the radar at a time, the other users are in read-only 
> mode. At any time, someone can take control of the radar, and other users are 
> notified, via a WDialog.
>
> I've adapted the ChatServer from the Wt examples/simplechat to notify other 
> users that someone has taken control of the radar.
>
> If I let my application run for a while, and close various Wt web windows, I 
> get the following exception:
>
> [2012-Nov-07 17:40:16.853950] 30410 [/ Ri6nRv7dPcrwokET] [info] 
> "WebController: timeout: expiring"
> terminate called after throwing an instance of 'Wt::WException'
>   what():  doRecursiveEventLoop(): session was killed
>
> Program received signal SIGABRT, Aborted.
>
> As shown below, WebSession.C throws an exception when a WebSession is "Dead":
>
>   if (state_ == Dead) {
>     recursiveEventLoop_ = 0;
>     throw WException("doRecursiveEventLoop(): session was killed");
>   }
>
> #7  0x017678a1 in Wt::WebSession::doRecursiveEventLoop (this=0x87776a8)
>     at /usr/local/src/wt-3.2.3/src/web/WebSession.C:1022
> #8  0x0143a7da in Wt::WDialog::exec (this=0x8807000, animation=...)
>     at /usr/local/src/wt-3.2.3/src/Wt/WDialog.C:292
> #9  0x08124cc2 in Login_GUI::confirm (this=0x8806f90, message=..., info=..., 
> id=..., passwd=...,
>     name=..., location=..., comment=...) at src/view/Login_GUI.cpp:75
> #10 0x0816d726 in UIServer::showLogin (this=0x8783b60, message=..., info=...)
>     at src/view/UIServer.cpp:705
> #11 0x0816e7a9 in UIServer::processStatusEvent (this=0x8783b60, event=...)
>     at src/view/UIServer.cpp:904
>
> What I need is some method of determining that a session is dead, so I can 
> avoid posting an event that shows a dialog, e.g.:
>       server_->post(i->second.sessionId,
>                    boost::bind(i->second.eventCallback, event));
>
> if the session is already dead.
>
> Since the WebSession class is not part of the published Wt API, I can't check 
> the result of WebSession::dead().  (That is, WebSession.h is not copied to 
> <prefix>/Wt/include, and depends on other internal include files.)
>
> Also, I rarely see calls to my WApplication derived class destructor or 
> finalize() methods after destroying a window, so I can't use these methods to 
> cleanup my list of "clients".
>
> Any ideas on how to avoid posting events to already dead (zombie?) sessions?
>
> Thanks much!
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to