Project

General

Profile

Site fails to load when linking IBM DB2 library

Added by Alan Jesser over 6 years ago

So this is a very bizarre issue. We has IBM DB2 databases. My Wt site runs fine until I link in the DB2 libraries. I thought maybe it was just how I was doing things but then I took the hello example and just linked the DB2 library to it and it failed to load a webpage as well. Nothing is returned. It seems that the callback function for WRun or WServer.addEntryPoint is never called. I'm not even sure why linking in the DB2 library would cause that.


Replies (6)

RE: Site fails to load when linking IBM DB2 library - Added by Wim Dumon over 6 years ago

Alan,

That's annoying. Is main() still called? Can you step through the code from there to see where it may hang? Alternatively, break the program when it hangs and take a look at the stack traces for the different threads. They may contain a hint...

Best regards,

Wim.

RE: Site fails to load when linking IBM DB2 library - Added by Alan Jesser over 6 years ago

Nothing is freezing or locking up. That's what's strange. The web page will say it was returned nothing when hit. Here is the code I have in my main.cpp. You'll see my console will output 1, 2, and 3 but it will never output CREATE. For some reason the call back function createApplication is never called when the DB2 library is linked in. The program continues to run like normal but since that entry point is never called it never really does anything but create sessions and destroy them until I stop it.

std::unique_ptr<Wt::WApplication> createApplication(const Wt::WEnvironment& env) {
  std::cout << "CREATE" << std::endl;
  return std::make_unique<ConversionApplication>(env);
}

int main(int argc, char **argv) {
  try {
    std::cout << "1" << std::endl;
    Wt::WServer server(argc, argv, WTHTTP_CONFIGURATION);
    std::cout << "2" << std::endl;
    server.addEntryPoint(Wt::EntryPointType::Application,
                         std::bind(&createApplication, std::placeholders::_1),"/");
    std::cout << "3" << std::endl;
    server.run();
  } catch (Wt::WServer::Exception& e) {
    std::cerr << e.what() << std::endl;
  } catch (std::exception &e) {
    std::cerr << "exception: " << e.what() << std::endl;
  }
}

RE: Site fails to load when linking IBM DB2 library - Added by Wim Dumon over 6 years ago

What's the output of the program?

Wim.

RE: Site fails to load when linking IBM DB2 library - Added by Alan Jesser over 6 years ago

Here's the output.

./conversion.wt --http-address 0.0.0.0 --http-port 8080 --docroot ../src/docroot/ -c ../wt_config.xml
1
[2017-Nov-13 07:05:30.077] 31906 - [info] "config: reading Wt config file: ../wt_config.xml (location = './conversion.wt')"
2
3
[2017-Nov-13 07:05:30.078] 31906 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2017-Nov-13 07:05:30.078] 31906 - [info] "wthttp: started server: http://0.0.0.0:8080"
1
[2017-Nov-13 07:05:40.543] 32054 - [info] "config: reading Wt config file: ../wt_config.xml (location = './conversion.wt')"
2
3
[2017-Nov-13 07:05:40.543] 32054 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2017-Nov-13 07:05:40.544] 32054 - [info] "wthttp: started server: http://127.0.0.1:0"
[2017-Nov-13 07:05:40.545] 32054 - [info] "Wt: session created (#sessions = 1)"
[2017-Nov-13 07:05:40.545] 32054 [/ 5nsntOtqgRIOeAxF] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0"
[2017-Nov-13 07:05:40.581] 32054 - [info] "WebRequest: took 35.672 ms"
192.168.74.1 - - [2017-Nov-13 07:05:40.581] "GET / HTTP/1.1" 200 0
192.168.74.1 - - [2017-Nov-13 07:05:40.720] "GET /favicon.ico HTTP/1.1" 404 85
192.168.74.1 - - [2017-Nov-13 07:05:40.797] "GET /favicon.ico HTTP/1.1" 404 85
[2017-Nov-13 07:05:50.544] 32054 [/ 5nsntOtqgRIOeAxF] [info] "WebController: timeout: expiring"
[2017-Nov-13 07:05:50.544] 32054 [/ 5nsntOtqgRIOeAxF] [info] "Wt: session destroyed (#sessions = 0)"
[2017-Nov-13 07:05:50.544] 32054 - [info] "WebController: shutdown: stopping 0 sessions."
[2017-Nov-13 07:05:50.544] 32054 - [info] "WServer/wthttp: Shutdown: stopping web server."
[2017-Nov-13 07:05:50.548] 31906 - [info] "wthttp/proxy: Child process 32054 died, removing session 5nsntOtqgRIOeAxF (#sessions: 0)"

RE: Site fails to load when linking IBM DB2 library - Added by Wim Dumon over 6 years ago

Hey,

It seems that you're running in dedicated sessions processes mode and the child exits (or crashes). Does this also happen when you run Wt in one process?

Best regards,

Wim.

RE: Site fails to load when linking IBM DB2 library - Added by Alan Jesser over 6 years ago

Here is the output when I run it with the default wt_config.xml that is shipped, which uses the on process method. I was trying different config options to see if that would help, but the results seem to be the same each time.

./conversion.wt --http-address 0.0.0.0 --http-port 8080 --docroot ../src/docroot/
1
[2017-Nov-13 07:57:43.924] 103789 - [info] "config: reading Wt config file: /etc/wt/wt_config.xml (location = './conversion.wt')"
2
3
[2017-Nov-13 07:57:43.925] 103789 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2017-Nov-13 07:57:43.925] 103789 - [info] "wthttp: started server: http://0.0.0.0:8080"
[2017-Nov-13 07:57:48.146] 103789 - [info] "Wt: session created (#sessions = 1)"
[2017-Nov-13 07:57:48.146] 103789 [/ D9Zrm9MGEZReOLua] [info] "WEnvironment: UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0"
192.168.74.1 - - [2017-Nov-13 07:57:48.147] "GET / HTTP/1.1" 200 0
[2017-Nov-13 07:57:48.147] 103789 - [info] "WebRequest: took 1.071 ms"
[2017-Nov-13 07:57:58.925] 103789 [/ D9Zrm9MGEZReOLua] [info] "WebController: timeout: expiring"
[2017-Nov-13 07:57:58.925] 103789 [/ D9Zrm9MGEZReOLua] [info] "Wt: session destroyed (#sessions = 0)"
    (1-6/6)