Project

General

Profile

WServer post and stop

Added by W X about 11 years ago

Hi,

I opened this post as continuation to this discussion: http://redmine.webtoolkit.eu/issues/1708

Initially my comments were added to issue 1708 because I thought I'm in a similar situation where WServer::stop blocks indefinitely.

Seems that my situation is a little different because I do some post()'s on WServer before calling WServer::stop.

If I understand correctly, according to Wim's comment (http://redmine.webtoolkit.eu/issues/1708#note-19), WSever::stop waits for the underlying io_service to become idle (that includes that there are no async callbacks).

Does this imply that this sequence:

WServer::post(callback)
WServer::stop()

where 'callback' updates the UI, will produce correct results in the sense that the UI updates will be propagated to the client before the server stops? In other words, is there a guarantee that WServer::stop will not stop the server until all pending posts are handled (including UI updates)? (note: server push in enabled, triggerUpdate is called).

In my application, with wt 3.3.0, even after waiting for a while between post() and stop() the UI is not updated before the server stops. (With wt 3.2.1 this worked).

With wt 3.3.0, occasionally, WServer::stop() blocks in boost::thread::interruptible_wait() while WIOservice joins the worker threads, as if the workers never stop (might be related to this boost issue: https://svn.boost.org/trac/boost/ticket/7552 ?)

In a small test application for the sequence above, using both wt 3.3.0 and 3.2.1, the UI is not updated unless I place a sleep() between post and stop().

Some help on this is very much appreciated.


Replies (3)

RE: WServer post and stop - Added by Zalu Hobgobicus about 9 years ago

I found this old unanswered question while wondering the same thing.

I.e., in the case we get a shut down request but want to complete any work in progress and/or do some last-minute actions, can we write WServer::post() calls immediately followed by WServer::stop(), and trust things will get completed before Wt shuts down, or should we do something between the last post and the stop, to keep Wt running until all outstanding work is done?

RE: WServer post and stop - Added by Wim Dumon about 9 years ago

Hello Zalu,

If you post() to a session and then call stop() immediately, I don't think it is guaranteed that the posted actions will reach the session before it is destroyed.

BR,

Wim.

    (1-3/3)