Bug #1332

WServer/wthttp: start(): server already started!

Added by navnidhi sharma over 9 years ago. Updated over 9 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


Is there any obvious reason I am getting the following error when i run my application as '-bash-4.1$ Debug/mychart ---docroot . ---http-address ---http-port 8080' :

[2012-Jun-20 09:33:35.767315] 10669 - [error] "WServer/wthttp: start(): server already started!"


I am using latest GCC, i.e. 4.7 and boost 1.49. The port(8080) is available and is NOT occupied by any other process. I ran a simple socket server raw C application, and it starts listening. Any help will be appreciated and thanks for the great tool.

Code -


#include "Charts.h"


#include <boost/thread.hpp>

#include <boost/date_time.hpp>

#include <boost/serialization/singleton.hpp>

using namespace Wt;

class Exchanges



Exchanges() : m_tradeQueue(m_io_mutex)



boost::mutex m_io_mutex;

ibc::Queue m_tradeQueue;


class ChartsApplication: public WApplication



boost::serialization::singleton exchanges;

ChartsApplication(const WEnvironment& env)

: WApplication(env)


setTitle("Charts example");


messageResourceBundle().use(appRoot() + "charts");


root()->resize(WLength::Auto, WLength::Auto);

new ChartsExample(root(), exchanges.get_mutable_instance().m_tradeQueue);


  • Set our style sheet last, so that it loaded after the ext stylesheets.

WApplication *createApplication(const WEnvironment& env)


WApplication *app = new ChartsApplication(env);

return app;


int main(int argc, char **argv)


int iret = WRun(argc, argv, &createApplication);

return iret;


-bash-4.1$ ldd Debug/mychart => (0x00007ffff7ec8000) => /home/nsharma/nsharma/Desktop/crtllc/sw/wt-3.2.1/build/src/Wt/Dbo/backend/ (0x00007ffb53879000) => /home/nsharma/nsharma/Desktop/sw/wt-3.2.1/build/src/Wt/Dbo/ (0x00007ffb535f2000) => /home/nsharma/nsharma/Desktop/sw/wt-3.2.1/build/src/Wt/Test/ (0x00007ffb533d8000) => /home/nsharma/nsharma/Desktop/sw/wt-3.2.1/build/src/http/ (0x00007ffb53117000) => /home/nsharma/nsharma/Desktop/sw/wt-3.2.1/build/src/ (0x00007ffb528bf000) => /opt/gcc-4.7.0/lib64/ (0x00007ffb52048000) => /lib64/ (0x000000331b600000) => /opt/gcc-4.7.0/lib64/ (0x00007ffb51e24000) => /lib64/ (0x000000331a600000) => /lib64/ (0x000000331ae00000) => /usr/lib64/ (0x0000003326e00000) => /lib64/ (0x000000331b200000) => /opt/boost_1_49_0_source/stage/lib/ (0x00007ffb51c12000) => /lib64/ (0x000000331aa00000) => /opt/boost_1_49_0_source/stage/lib/ (0x00007ffb519f6000) => /opt/boost_1_49_0_source/stage/lib/ (0x00007ffb517f4000) => /opt/boost_1_49_0_source/stage/lib/ (0x00007ffb51500000) => /opt/boost_1_49_0_source/stage/lib/ (0x00007ffb512ec000) => /opt/boost_1_49_0_source/stage/lib/ (0x00007ffb510e9000) => /usr/lib64/ (0x000000332aa00000) => /opt/CollabNet_Subversion/lib/ (0x00007ffb50fd1000) => /opt/boost_1_49_0_source/stage/lib/ (0x00007ffb50db1000) => /opt/boost_1_49_0_source/stage/lib/ (0x00007ffb50b51000)

/lib64/ (0x000000331a200000) => /lib64/ (0x0000003327e00000) => /lib64/ (0x0000003327200000) => /lib64/ (0x0000003325600000) => /lib64/ (0x0000003326200000) => /lib64/ (0x0000003325e00000) => /lib64/ (0x0000003326a00000) => /lib64/ (0x000000331c600000) => /lib64/ (0x000000331c200000)


Updated by Wim Dumon over 9 years ago

This message has nothing to do with TCP ports being occupied, but rather with starting an already started WServer (i.e. calling WServer twice).

Note that only one WServer may exist per process - that could maybe explain what you see.

No idea why you see this error; your best option is to step into WRun and WServer::start() and see what is going on there. It may also be a build problem? Did you compile everything with the same compiler version?



Updated by navnidhi sharma over 9 years ago

thanks for the quick response. You were correct.

I see for some reason WRun is calling 'WServer server(argv[0], "");' two times. howver, I am calling it only once.

int WRun(int argc, char *argv[], ApplicationCreator createApplication)


try {

WServer server(argv[0], "");

try {





Wt::WRun(int, char, Wt::ApplicationCreator):

0x7ffff7692ab0: ...icationCreator)+0 push %r15

0x7ffff7692ab2: ...icationCreator)+2 push %r14

0x7ffff7692ab4: ...icationCreator)+4 mov %edi,%r14d

0x7ffff7692ab7: ...icationCreator)+7 push %r13

0x7ffff7692ab9: ...icationCreator)+9 push %r12

0x7ffff7692abb: ...cationCreator)+11 mov %rsi,%r12

229 WServer server(argv[0], "");

0x7ffff7692abe: ...cationCreator)+14 lea 0x6353(%rip),%rsi # 0x7ffff7698e18

227 {

0x7ffff7692ac5: ...cationCreator)+21 push %rbp

0x7ffff7692ac6: ...cationCreator)+22 mov %rdx,%rbp

0x7ffff7692ac9: ...cationCreator)+25 push %rbx

0x7ffff7692aca: ...cationCreator)+26 sub $0x158,%rsp

229 WServer server(argv[0], "");

0x7ffff7692ad1: ...cationCreator)+33 lea 0xe(%rsp),%rdx

0x7ffff7692ad6: ...cationCreator)+38 lea 0x20(%rsp),%rdi

0x7ffff7692adb: ...cationCreator)+43 callq 0x7ffff7654df8 <_ZNSsC1EPKcRKSaIcE@plt>

0x7ffff7692ae0: ...cationCreator)+48 mov (%r12),%rsi

0x7ffff7692ae4: ...cationCreator)+52 lea 0xd(%rsp),%rdx

0x7ffff7692ae9: ...cationCreator)+57 lea 0x10(%rsp),%rdi

0x7ffff7692aee: ...cationCreator)+62 callq 0x7ffff7654df8 <_ZNSsC1EPKcRKSaIcE@plt>

0x7ffff7692af3: ...cationCreator)+67 lea 0x20(%rsp),%rdx

0x7ffff7692af8: ...cationCreator)+72 lea 0x10(%rsp),%rsi

0x7ffff7692afd: ...cationCreator)+77 lea 0xc0(%rsp),%rdi

0x7ffff7692b05: ...cationCreator)+85 callq 0x7ffff7653ce8 <ZN2Wt7WServerC1ERKSsS2@plt>

0x7ffff7692b0a: ...cationCreator)+90 mov 0x10(%rsp),%r13

0x7ffff7692b0f: ...cationCreator)+95 mov 0x22493a(%rip),%rbx # 0x7ffff78b7450

0x7ffff7692b16: ...ationCreator)+102 sub $0x18,%r13

0x7ffff7692b1a: ...ationCreator)+106 cmp %rbx,%r13

0x7ffff7692b1d: ...ationCreator)+109 jne 0x7ffff7692e08 <Wt::WRun(int, char, Wt::ApplicationCreator)+856>

0x7ffff7692b23: ...ationCreator)+115 mov 0x20(%rsp),%r13

Very strange, I wish I could have understood the assembely. Do you have any idea?

Thannks again!


Updated by navnidhi sharma over 9 years ago


Please close it. The issue no longer exists. The reason was incorrect Wt build with the latest GCC4.7. I rebuilt the library and it went aways.



Updated by Koen Deforche over 9 years ago

  • Status changed from New to Closed

Also available in: Atom PDF