Project

General

Profile

Segmentation fault when initializing wthttpd

Added by George McFie over 1 year ago

Despite having successfully managed to use the Wt libraries many times before, this one has me stumped.

I've created minimal instance of a webserver that does virtually nothing, but just after the call to 'Wt::WServer.start()', it generates following log message "WServer/wthttp: initializing built-in wthttpd", and immediately terminates with a segmentation fault.
I can confirm that these startup parameters are valid ...

--approot = /home/test/vms/bin/web/aug
--docroot = /home/test/vms/bin/web/aug
--config = /home/test/vms/bin/web/aug/wt_config.xml
--deploy-path = /aug
--http-address = 0.0.0.0
--http-port = 8704

These are the last console entries ...
[2022-Jul-05 10:46:36.174] 3480935 - [info] "WServer/wthttp: initializing built-in wthttpd"
Segmentation fault (core dumped)

Can anyone suggest where I might start looking for the cause of this problem? Any suggestions would be welcome.
Thanks in advance.


Replies (2)

RE: Segmentation fault when initializing wthttpd - Added by Bruce Toll over 1 year ago

Hi George,

Segfaults can occur for a variety of reasons. You may find a tool like gdb helpful to observe where the segfault is occurring (using the "bt" command). A debug build of Wt and your application will make this easier.

You may also want to double-check that your application is built correctly. You can run ldd on the binary to verify that you are linking with the libraries that you expect. Also, verify that the header files that you are including in your build are from the same version of Wt as the library that you are linking to and that the library and your application are built with the same compiler and compatible compiler flags.

If the cause is still unclear, you may be able to narrow things down by building an even more minimal application (possibly based on a Wt example) to check whether it runs successfully.

Hope this helps. --Bruce

RE: Segmentation fault when initializing wthttpd - Added by George McFie over 1 year ago

Thanks for your feedback Bruce - much appreciated.

I eventually did find a solution to the problem, but I'm still slightly
mystified as to why this solves the problem.
I'm using Qt for my project builds and my project file included the
following ...

INCLUDEPATH += $(BOOST_ROOT) \

    $(TRUVELO_ROOT) \

    $(TRUVELO_ROOT)/device

Just by changing this to ...

INCLUDEPATH += $(TRUVELO_ROOT) \

    $(OPENCV_ROOT) \

    $(TRUVELO_ROOT)/device

... the problem was resolved.
My guess is that somewhere (possibly in the boost folders), there is a
similar but not identical header file to another one found if the INCLUDE
path is changed as above. Another feature of the issue is that the problem
only ever occurred if I was building for Ubuntu 20.04. On Mint 20.3 both
project INCLUDE statements worked. Very strange!

It literally took me the whole day to solve this so I'm not going to try to
pursue it further today - perhaps another day. Suffice it to say that the
issue is now resolved and I can now move on.

Thanks again for your feedback.

On Tue, Jul 5, 2022 at 4:55 PM Emweb Redmine wt-redmine@emweb.be wrote:

http://redmine.emweb.be/boards/1/topics/18011?r=18012#message-18012
Bruce Toll

Hi George,

Segfaults can occur for a variety of reasons. You may find a tool like gdb
helpful to observe where the segfault is occurring (using the "bt"
command). A debug build of Wt and your application will make this easier.

You may also want to double-check that your application is built
correctly. You can run ldd on the binary to verify that you are linking
with the libraries that you expect. Also, verify that the header files that
you are including in your build are from the same version of Wt as the
library that you are linking to and that the library and your application
are built with the same compiler and compatible compiler flags.

If the cause is still unclear, you may be able to narrow things down by
building an even more minimal application (possibly based on a Wt example)
to check whether it runs successfully.

Hope this helps. --Bruce

--
You have received this notification because you have either subscribed to
it, or are involved in it.
You can disable it by changing your account settings.

    (1-2/2)