Good question. I've attached the main.cpp file for testing purposes. The
cmake stanza I'm using looks like
add_executable( test_wt main.cpp )
target_link_libraries( test_wt ${Wt_DEBUG_LIBRARY}
${Wt_HTTP_DEBUG_LIBRARY} -lboost_system )
Output, when io_service is not included:
[2012-May-31 16:13:34.326820] 32676 - [info] "config: reading Wt config
file: /etc/wt/wt_config.xml (location = '')"
[2012-May-31 16:13:34.327745] 32676 - [info] "wthttp: reading wthttpd
configuration from: /etc/wt/wthttpd"
[2012-May-31 16:13:34.327970] 32676 - [info] "WServer/wthttp:
initializing built-in wthttpd"
[2012-May-31 16:13:34.328310] 32676 - [info] "wthttp: started server:
http://0.0.0.0:7654"
[2012-May-31 16:13:34.328759] 32676 - [info] "WebController: shutdown:
stopping sessions."
[2012-May-31 16:13:34.328843] 32676 - [info] "WServer/wthttp: Shutdown:
stopping web server."
Output, when io_service is included:
./test_wt
[2012-May-31 16:12:50.046175] 32641 - [info] "config: reading Wt config
file: /etc/wt/wt_config.xml (location = '')"
[2012-May-31 16:12:50.047126] 32641 - [info] "wthttp: reading wthttpd
configuration from: /etc/wt/wthttpd"
[2012-May-31 16:12:50.047323] 32641 - [info] "WServer/wthttp:
initializing built-in wthttpd"
Segmentation fault
or it stalls after initing wthttpd:
$ ./test_wt
[2012-May-31 16:17:43.404128] 425 - [info] "config: reading Wt config
file: /etc/wt/wt_config.xml (location = '')"
[2012-May-31 16:17:43.404983] 425 - [info] "wthttp: reading wthttpd
configuration from: /etc/wt/wthttpd"
[2012-May-31 16:17:43.405133] 425 - [info] "WServer/wthttp: initializing
built-in wthttpd"
... nothing happens
When running in gdb, this testcase usually just stalls,
#0 __lll_lock_wait () at
../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
#1 0x00007ffff634bb0c in pthread_cond_signal@@GLIBC_2.3.2 () at
../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S:142
#2 0x00007ffff787a06d in
boost::asio::detail::task_io_service::init_task (this=0x648270) at
/usr/include/boost/asio/detail/impl/task_io_service.ipp:118
#3 0x00007ffff7311da6 in init_task (this=<optimized out>) at
/usr/include/boost/asio/detail/impl/epoll_reactor.ipp:145
#4 reactive_socket_service_base (io_service=..., this=0x649f78) at
/usr/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:34
#5 reactive_socket_service (io_service=..., this=0x649f78) at
/usr/include/boost/asio/detail/reactive_socket_service.hpp:77
#6 socket_acceptor_service (io_service=..., this=0x649f50) at
/usr/include/boost/asio/socket_acceptor_service.hpp:89
#7
boost::asio::detail::service_registry::create<boost::asio::socket_acceptor_service<boost::asio::ip::tcp>
> (owner=...)
at /usr/include/boost/asio/detail/impl/service_registry.hpp:81
#8 0x00007ffff7878217 in
boost::asio::detail::service_registry::do_use_service (this=0x648220,
key=...,
factory=0x7ffff7311d50
<boost::asio::detail::service_registry::create<boost::asio::socket_acceptor_service<boost::asio::ip::tcp>
>(boost::asio::io_service&)>) at
/usr/include/boost/asio/detail/impl/service_registry.ipp:123
#9 0x00007ffff73125f7 in
boost::asio::detail::service_registry::use_service<boost::asio::socket_acceptor_service<boost::asio::ip::tcp>
> (this=<optimized out>)
at /usr/include/boost/asio/detail/impl/service_registry.hpp:48
#10 0x00007ffff730c74d in
use_service<boost::asio::socket_acceptor_service<boost::asio::ip::tcp> >
(ios=...) at /usr/include/boost/asio/impl/io_service.hpp:33
#11 basic_io_object (io_service=..., this=0x648058) at
/usr/include/boost/asio/basic_io_object.hpp:90
#12 basic_socket_acceptor (io_service=..., this=0x648058) at
/usr/include/boost/asio/basic_socket_acceptor.hpp:83
#13 http::server::Server::Server (this=0x647f40, config=...,
wtServer=...) at /home/pgquiles/wt/b/witty-3.2.1/src/http/Server.C:65
#14 0x00007ffff732171e in Wt::WServer::start (this=0x7fffffffe0f0) at
/home/pgquiles/wt/b/witty-3.2.1/src/http/WServer.C:147
#15 0x000000000040a8ef in server::run (this=0x7fffffffe0f0) at
/home/rutger/.../sandbox/wt/main.cpp:10
#16 0x0000000000408da3 in main (argc=1, argv=0x7fffffffe288) at
/home/rutger/.../sandbox/wt/main.cpp:20
in an other (bigger) program, I get:
#0 0x000000000045fd81 in
boost::asio::detail::reactive_socket_service_base::destroy (this=0x2a,
impl=...)
at
/usr/include/boost/asio/detail/impl/reactive_socket_service_base.ipp:87
#1 0x0000000000464771 in
boost::asio::socket_acceptor_service<boost::asio::ip::tcp>::destroy
(this=0x2, impl=...)
at /usr/include/boost/asio/socket_acceptor_service.hpp:119
#2 0x000000000046408b in
boost::asio::basic_io_object<boost::asio::socket_acceptor_service<boost::asio::ip::tcp>,
true>::~basic_io_object (this=0x6c6e10,
__in_chrg=<optimized out>) at
/usr/include/boost/asio/basic_io_object.hpp:196
#3 0x0000000000463bfc in
boost::asio::basic_socket_acceptor<boost::asio::ip::tcp,
boost::asio::socket_acceptor_service<boost::asio::ip::tcp>
>::~basic_socket_acceptor (this=0x6c6e10, __in_chrg=<optimized out>) at
/usr/include/boost/asio/basic_socket_acceptor.hpp:54
#4 0x00007ffff6735bcd in http::server::Server::Server (this=0x6c6cc0,
config=..., wtServer=...) at
/home/pgquiles/wt/b/witty-3.2.1/src/http/Server.C:65
#5 0x00007ffff674a71e in Wt::WServer::start (this=0x6b5d30) at
/home/pgquiles/wt/b/witty-3.2.1/src/http/WServer.C:147
...
On 2012-05-31 16:03, Wim Dumon wrote:
Rutger,
Is there any sensible information in the stack trace?
Best regards,
Wim.
2012/5/31 Rutger ter Borg
<[email protected]
<mailto:[email protected]>>
I'm on Debian Sid, using your packages (thanks for them, btw) 3.2.1-2
and boost packages 1.49.0. In contrast what's happening in the
bugreport, in this case I have a clean compile, no warnings of any kind.
Cheers,
Rutger
On 2012-05-31 14:12, Pau Garcia i Quiles wrote:
> Hi,
>
> What version of Wt is this? Are you sure you are not mixing different
> versions of Boost? (per
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=666180 )
>
>
>
> On Thu, May 31, 2012 at 2:06 PM, Rutger ter
Borg<[email protected]
<mailto:[email protected]>> wrote:
>>
>> Dear list,
>>
>> I'm trying to mix Boot.Asio and Wt libraries in a project of mine.
>> Unfortunately, they do not cooperate nicely. I've narrowed it
down to
>> the following case:
>>
>> struct server {
>> void run() {
>> server_.setServerConfiguration( 1, 0, "/etc/wt/wthttpd" );
>> bool success = server_.start();
>> }
>>
>> Wt::WServer server_;
>>
>> // Uncomment for segmentation fault
>> //boost::asio::io_service ios;
>> };
>>
>> int main() {
>> server s;
>> s.run();
>> }
>>
>> Just by adding an instance of Asio's io_service, running this
class' run
>> method will give yield a segmentation fault. It will also cause a
>> segmentation fault by linking in io_service from somewhere else.
>>
>> Any hints and/or suggestions on how to circumvent this?
>>
>> A more minor point: the configuration doesn't get read in case I
pass
>> argc==0 to setServerConfiguration. Why is that?
>>
>> Thanks,
>>
>> Rutger
>>
>>
>>
>>
------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond.
Discussions
>> will include endpoint security, mobile security and the latest
in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> witty-interest mailing list
>> [email protected]
<mailto:[email protected]>
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond.
Discussions
will include endpoint security, mobile security and the latest in
malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest
#include <boost/asio/io_service.hpp>
#include <Wt/WServer>
#include <cstdlib>
struct server {
void run() {
server_.setServerConfiguration( 1, 0, "/etc/wt/wthttpd" );
bool success = server_.start();
}
Wt::WServer server_;
boost::asio::io_service ios;
};
int main( int argc, char *argv[] ) {
server a;
a.run();
return EXIT_SUCCESS;
}
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest