[SERVER-9964] mongod crashes when client disconnects (OpenIndiana 157a8) Created: 19/Jun/13 Updated: 26/Nov/13 Resolved: 20/Jun/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Networking |
| Affects Version/s: | 2.4.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Udo Grabowski | Assignee: | Tad Marshall |
| Resolution: | Done | Votes: | 0 |
| Labels: | crash | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Opensolaris x86-64 (openindiana 157a8) on both own build and smartos build (pthreads, |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | Solaris | ||||||||
| Steps To Reproduce: | start mongod (LANG=C, LC_ALL=C required, otherwise it crashes in localeImpl), |
||||||||
| Participants: | |||||||||
| Description |
|
When the client disconnects, mongod crashes with a segfault in
|
| Comments |
| Comment by Tad Marshall [ 26/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for the update! Good luck on your OI projects! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 26/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Problem has gone away with newest gcc 4.7.3 and libstdc++.so.6.0.17 from OI 151a8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Udo, That's great news! Thanks for testing it! I'm going to close this ticket as "Works as designed", but we'd love to hear what you learn from the OpenIndiana GCC folks. You can post updates to this ticket even after it is closed. Tad | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Correction: Workaround with Opencsw libraries also works on a7, pfexec did not forward the LD_LIBRARY_PATH in my test. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
> uploaded and see if the symptoms are the same? Thanks a lot, this sheds some (irritating) light on the problem. BUT: Did the same on a8, and, Jippeeee, it works !! So I think from this point on it's a problem for the gcc In the meanwhile, I'll just attach the OCSW libraries to our Thanks a lot for your assistance, I really appreciate the ro sunug1 /install/mongodb-src-r2.4.4 # setenv LD_LIBRARY_PATH /tmp/gcclibs/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Can you try the libraries from the gcclibs.tgz file I uploaded and see if the symptoms are the same? Looking at the code, the message "Socket recv() conn closed? 127.0.0.1:37593" is normal at log level 3 or higher; I see the same thing when run with -vvvv. This is also a normal code path for a connection that has been terminated. The code then constructs an exception object and throws a SocketException, which is a normal action in MongoDB for this event. For some reason, you get a segfault during the construction of the exception object, apparently while allocating memory for a string, but this does not happen on my system. This is making me suspicious of the C++ library you are running. It's just an experiment, but the files I attached are the ones that are working for me in OpenIndiana, so if you get the same problem with these files then at least we will know that it is not due to a difference in libraries. The libstdc++.so.6.0.16 needs to be symlinked as libstdc++.so.6. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Two gcc libraries for SunOS 5 derived OSes, extracted from gcc 4.6.3 from OpenCSW: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
> as the current version (labeled development in bold letters). OI is currently respun with a larger staff of developers So, sorry if you got accidently involved into a homebrew | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In the packagemanager, replace the /dev/ publisher ( <http://pkg.openindiana.org/hipster/> then press 'Updates', and it will update to There you can also add the libraries to run mongo without LD_LIBRARY_PATH) . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Where can I download 157a8? The openindiana.org website shows 151a7 as the current version (labeled development in bold letters). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Similar results using the 2.4.4 version from mongodb.org, except that the libstdc++.so.6 that it uses by default on this system is too old and doesn't have all the C++ symbols we need:
Making it use the OpenCSW version of libstdc++.so.6 fixes that problem:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
a7 is fine, if it does not crash, we know where to look at. > I can't reproduce your problem. I'm building with g++ Huh, just got that while writing my mail. Interesting. Thanks for your fast and invaluable help so far ! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The build (of just mongod and mongo) finished and I tested. I can't reproduce your problem. I'm building with g++ from OpenCSW, in case that matters. My command line was:
The shell session was:
The server side looked like this:
The "got signal 2" happened when I pressed ctrl-C. Do you think I need to try OpenIndiana 157a8? This seems like it might be an OpenIndiana problem, since we seem to work OK with the earlier version. This is my compiler and build info:
I'll study the code and your stack trace and see if there is a problem I can spot. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'm building on OpenIndiana now (running under VirtualBox). The performance in this instance is terrible ... very sluggish. I've seen similar bad performance in the Solaris 11 VM I downloaded from Oracle, but the Solaris 11.1 VM that I created by booting from the .ISO runs at an acceptable speed. Are SunOS 5.11 level OSes just bad performers running virtualized? Is VirtualBox a poor container for Solaris? Perhaps the guest additions are poor. The OpenIndiana build that I'm testing is 151a7, not the 157a8 that you are using. Should I give up and create a new 157a8 VM? If I don't see the problems you are seeing (when the build eventually finishes), we still won't know if the problem is specific to OpenIndiana build 157a8. Thoughts? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 20/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes, this is the original 2.4.4 tarball. Backtrace resolved to source lines, the ffffxxx are system libraries, and the 0xddd1d4 is ro sunug1 /install/mongodb-src-r2.4.4 # foreach a ( 0xdecd18 0x95558e 0x95590f 0xffffdd7fff8d7516 0xffffdd7fff8ca09c 0xdd86e8 0xffffdd7fff8def05 0xffffdd7fffb53ad9 0xde2b59 0xde3021 0xdda68e 0xddd1d4 0xe3dbae 0xffffdd7fff8d7184 0xffffdd7fff8d7450) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 19/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Can you run addr2line on the list of addresses? And this is 2.4.4 from the source tarball? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 19/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Checked that, the same problem with ip:port given. It looks to my like this is only Wed Jun 19 18:43:37.695 Backtrace: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 19/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here is the info from the Joyent SmartOS builder we use to create the .tgz file on mongodb.org:
So, compiler version seems unlikely to be the difference. Here is the ldd -r output on Solaris 11.1:
Here is the ldd -r output on Joyent:
It seems that they are all different. My Solaris has /lib/64/libcryptoutil.so.1, your OpenIndiana has /lib/64/libdl.so.1, Joyent has neither. Let's assume for now that this is an OpenIndiana issue and I will try to reproduce it. I need to finish setting up OpenIndiana to do that ... I'll let you know if I have problems. If you want to experiment, the code that is having problems seems to run only when you don't specify the address of the host you are connecting to. You could try
and see if the symptoms change at all. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 19/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tried that, compiled without issues, but still the same problem. /usr/gcc/4.6/bin/g++ -o | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 19/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ok, I'll try that, although the modifications seem not to touch the Yes. > See "Steps to reproduce:": local ./mongo, then exit. > possibly in combination with poor error handling in MongoDB. Since Oracle closed their source after build 148 (which is, actually, Here is the detailed resolver list, nothing unusual: > 127.0.0.1:37593" error you are seeing. It seems likely that the error handling This is the debug output with -vvvvv on mongod. Generated in It would be helpful if you know some tips how to stop a thread Regards, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 19/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Udo, Thanks for the update. I had made a start at creating an OpenIndiana VM (a guest OS in VirtualBox) a while ago, but did not bring it to the point where I had all of the MongoDB build prerequisites installed. If it seems that this problem is specific to OpenIndiana, I can finish setting up the VM and try to reproduce the problem. The build instructions you linked to are interesting and odd. They do not describe the version of MongoDB where they had to do all these things, but simply point to our "master" branch, which changes every day. I have been building recently in Solaris 10 and Solaris 11 and also in SmartOS 5.11 in a Joyent instance. I have not had to do any of the steps listed in http://sptci.com/docs/cpp/mongodbOpenIndiana.html . In Solaris 11.1, the command I use to build a release (optimized) version of MongoDB is:
None of the source code files are modified from the current master code. Here is some environment info:
When you say
are you refering to the problem described in this Jira ticket? Not all of my questions have been answered: 1) What is the client connection (e.g. mongo shell, some application using a particular driver)? 2) How did the client close the connection? Is this just an exit from the mongo shell, or some other method? So far, this seems like it might be a difference between Solaris and OpenIndiana, possibly in combination with poor error handling in MongoDB. My understanding is that OpenIndiana strives to be compatible with Solaris, so I don't think we're supposed to be seeing differences between them. I'd like to understand how I can generate the "[conn1] Socket recv() conn closed? 127.0.0.1:37593" error you are seeing. It seems likely that the error handling for this case is faulty, and that this is the source of the segfault. Can you answer my questions regarding the connection, please? Thanks! Tad | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 19/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Another stacktrace, this time with gdb. I did not manage to get the thread conn1 #ifdef _GXX_EXPERIMENTAL_CXX0X_ Also, the port value seems to be bogus. GDB stacktrace: Program received signal SIGSEGV, Segmentation fault. #6 0x0000000000ddd6e4 in mongo::PortMessageServer::handleIncomingMsg (arg=warning: (Internal error: pc 0xddd6e3 in read in psymtab, but not in symtab.) warning: (Internal error: pc 0xddd2d0 in read in psymtab, but not in symtab.) warning: (Internal error: pc 0xddd6e3 in read in psymtab, but not in symtab.) 0x329fdd0) at src/mongo/util/net/message_server_port.cpp:196 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Udo Grabowski [ 19/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Build as described in the section 'Build MongoDB' at: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Tad Marshall [ 19/Jun/13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Udo, Thanks for the report, and for the log and dbx output. Are you able to reproduce this using the Solaris/SmartOS build downloaded from mongodb.org (http://fastdl.mongodb.org/sunos5/mongodb-sunos5-x86_64-2.4.4.tgz)? Is there any special reason to build your own version; did you change build options? Can you provide the scons command line you used, along with anything else we would need to try to build the same binary you built? What is the client connection (e.g. mongo shell, some application using a particular driver)? Is the connection from localhost or over a network? What version of gcc did you use to build it? How did the client close the connection? Is this just an exit from the mongo shell, or some other method? The message "[conn1] Socket recv() conn closed? 127.0.0.1:37593" is not the usual "connection closed" message (which is something like "[conn1] end connection 127.0.0.1:54959 (0 connections now open)"). Since you have source code and a debugger, are you able to see what is going wrong in the error handling? Tad |