Open 0x10 opened 11 years ago
@0x10 - can you test with my fork of the code at https://github.com/sebjameswml/node.native ?
Let me know if you still see this problem.
As far as I can say, the segfault did not appear anymore. I did some other concurrent/parallel tests and it seems fine.
What was the problem?
It was a memory management problem; same core problem as Issue#28.
I used the master branch. Compile went without problems with g++ 4.7.3: Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.3-4' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --enable-objc-gc --with-cloog --enable-cloog-backend=ppl --disable-cloog-version-check --disable-ppl-version-check --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.3 (Debian 4.7.3-4)
I started the webserver with: gdb webserver
And called multiple clients: for run in {1..300} ; do ./webclient& done
And it crashed. Looks like there is a uv_handle missing...
Program received signal SIGSEGV, Segmentation fault. 0x00000000004069d9 in native::base::stream::write(char const*, int, std::function<void (native::error)>) (this=0x642650, buf=0x642588 "HTTP/1.1 200 OK\r\nContent-Length: 8\r\nContent-Type: text/plain\r\n\r\nC++ FTW\n", len=72, callback=...) at ./native/stream.h:75 75 callbacks::store(get()->data, native::internal::uv_cid_write, callback);
(gdb) disassemble Dump of assembler code for function native::base::stream::write(char const_, int, std::function<void (native::error)>): ... 0x00000000004069d4 <+50>: callq 0x409536 native::base::handle::get<uv_handles()> => 0x00000000004069d9 <+55>: mov 0x8(%rax),%rax 0x00000000004069dd <+59>: mov -0x50(%rbp),%rdx 0x00000000004069e1 <+63>: mov $0x0,%ecx 0x00000000004069e6 <+68>: mov $0x3,%esi 0x00000000004069eb <+73>: mov %rax,%rdi 0x00000000004069ee <+76>: callq 0x40969b <native::callbacks::store<std::function<void (native::error)> >(void, int, std::function<void (native::error)> const&, void*)> ...