Bug #850
closedwthttp deployment on / with docroot ".;resources" causes new sessions to be created in Chrome 11
0%
Description
(copied message from mailing list)
developing a Wt application I noticed a lot of 'Timeout: expiring' and 'Session
destroyed (#sessions = x)' messages I could not explain.
To debug this, I created a minimal example:
#include
#include
#include
#include
#include
using namespace Wt;
using namespace std;
class Main : public WApplication {
private:
bool emitchange;
unsigned state;
public:
Main(const WEnvironment &e)
: WApplication(e), emitchange(false), state(0)
{
log("info") << "Constructing new session";
WPushButton *a = new WPushButton("foo", root());
a->clicked().connect(this, &Main::foo);
WPushButton *b = new WPushButton("bar", root());
b->clicked().connect(this, &Main::bar);
WCheckBox *c = new WCheckBox("emit change", root());
c->changed().connect(this, &Main::toggle);
}
void foo()
{
log("info") << "foo got clicked! state:" << state;
setInternalPath("/foo", emitchange);
}
void bar()
{
log("info") << "bar got clicked! state:" << state;
setInternalPath("/bar", emitchange);
}
void toggle() { emitchange = !emitchange; log("info") << "emit change: " << emitchange; }
};
Wt::WApplication *create_app(const Wt::WEnvironment& env)
{
return new Main(env);
}
int main(int argc, char **argv)
{
return WRun(argc, argv, &create_app);
}
I run it with this command:
./p.wt ---docroot='.;resources' ---deploy-path '/' ---http-address 127.0.0.1 ---http-port 8080
Using Chromium 11, for each button click I get following block of lines like this:
[2011-Jun-07 23:22:31.881103] 15768 [/ BgODYliXr92U50EP] [info] "foo got clicked! state:1"
127.0.0.1 - - [2011-Jun-07 23:22:31.881829] "POST /bar?wtd=BgODYliXr92U50EP HTTP/1.1" 200 60
[2011-Jun-07 23:22:31.912402] 15768 [/ DIISm4AkiYAgbzFm] [notice] "Session created (#sessions = 5)"
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Ubuntu/10.04 Chromium/11.0.696.65 Chrome/11.0.696.65 Safari/534.24
127.0.0.1 - - [2011-Jun-07 23:22:31.913249] "GET /favicon.ico HTTP/1.1" 200 1641
Or waiting a bit after some clicking:
[2011-Jun-07 23:23:19.151773] 15768 [/ BgODYliXr92U50EP] [info] "foo got clicked! state:2"
[2011-Jun-07 23:23:19.152229] 15768 [/ 0nOSG9eUL2kkLlZx] [notice] "Timeout: expiring"
[2011-Jun-07 23:23:19.152313] 15768 [/ DIISm4AkiYAgbzFm] [notice] "Timeout: expiring"
[2011-Jun-07 23:23:19.152373] 15768 [/ MXC0G56m4hj6Wjwa] [notice] "Timeout: expiring"
[2011-Jun-07 23:23:19.152424] 15768 [/ QX1ff4P3FxWDCOet] [notice] "Timeout: expiring"
[2011-Jun-07 23:23:19.152530] 15768 [/ 0nOSG9eUL2kkLlZx] [notice] "Session destroyed (#sessions = 1)"
[2011-Jun-07 23:23:19.152630] 15768 [/ DIISm4AkiYAgbzFm] [notice] "Session destroyed (#sessions = 1)"
[2011-Jun-07 23:23:19.152739] 15768 [/ MXC0G56m4hj6Wjwa] [notice] "Session destroyed (#sessions = 1)"
[2011-Jun-07 23:23:19.152815] 15768 [/ QX1ff4P3FxWDCOet] [notice] "Session destroyed (#sessions = 1)"
127.0.0.1 - - [2011-Jun-07 23:23:19.153171] "POST /foo?wtd=BgODYliXr92U50EP HTTP/1.1" 200 60
Or this:
[2011-Jun-07 23:23:34.231512] 15768 [/ BgODYliXr92U50EP] [info] "bar got clicked! state:3"
127.0.0.1 - - [2011-Jun-07 23:23:34.232276] "POST /foo?wtd=BgODYliXr92U50EP HTTP/1.1" 200 60
[2011-Jun-07 23:23:34.262017] 15768 [/ b6x9sEGvQgn3AY41] [notice] "Session created (#sessions = 2)"
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Ubuntu/10.04 Chromium/11.0.696.65 Chrome/11.0.696.65 Safari/534.24
127.0.0.1 - - [2011-Jun-07 23:23:34.262780] "GET /favicon.ico HTTP/1.1" 200 1640
What do these messages mean?
How do I get rid of these messages? What is the purpose of them?
I thought that for each new 'session' a WApplication instance (== a Main
instance in this case) is created (via create_app, which is invoked by
Wt). But this is not the case here, because the state value is not reset
(and no more 'Constructing new session' messages are displayed).
With Firefox 3.6 I don't get such a massive amount of 'session
destroyed'/timeout messages, except at startup one/two spurious ones, e.g.:
[2011-Jun-07 23:30:51.443921] 15809 [/ DzIjAsat35qI7CUG] [info] "foo got clicked! state:0"
[2011-Jun-07 23:30:51.444487] 15809 [/ X3iTDjJ5vdo3a8h6] [notice] "Timeout: expiring"
[2011-Jun-07 23:30:51.444600] 15809 [/ X3iTDjJ5vdo3a8h6] [notice] "Session destroyed (#sessions = 1)"
127.0.0.1 - - [2011-Jun-07 23:30:51.444827] "POST /?wtd=DzIjAsat35qI7CUG HTTP/1.1" 200 85
[2011-Jun-07 23:30:52.000871] 15809 [/ DzIjAsat35qI7CUG] [info] "bar got clicked! state:1"
127.0.0.1 - - [2011-Jun-07 23:30:52.001824] "POST /?wtd=DzIjAsat35qI7CUG HTTP/1.1" 200 60
[2011-Jun-07 23:30:53.125405] 15809 [/ DzIjAsat35qI7CUG] [info] "emit change: 1"
127.0.0.1 - - [2011-Jun-07 23:30:53.126185] "POST /?wtd=DzIjAsat35qI7CUG HTTP/1.1" 200 41
[2011-Jun-07 23:30:55.488739] 15809 [/ DzIjAsat35qI7CUG] [info] "bar got clicked! state:2"
I am using Wt 3.1.9 and following CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
set(CMAKE_VERBOSE_MAKEFILE on)
LINK_DIRECTORIES(/mnt/juser/local/wt-3.1.9/lib)
SET (EXAMPLES_CONNECTOR wthttp)
ADD_EXECUTABLE(p.wt main.C)
TARGET_LINK_LIBRARIES(p.wt ${EXAMPLES_CONNECTOR})
INCLUDE_DIRECTORIES(/mnt/juser/local/wt-3.1.9/include)
Best regards
Georg
Updated by Koen Deforche over 13 years ago
- Status changed from New to Resolved
Hey,
The browser is requesting /favicon.ico which triggers this sinceit is handled as if it were an internal path.
You need to add it to the docroot path list.
Koen
Updated by Koen Deforche over 13 years ago
- Status changed from Resolved to Closed