2

My MongoDB server crash after running a query with find on the field that has an index(with 2 fields) on it but without filter works normally. when I remove the index Mongodb works fine. And you could find the details of its crash as the below:

use local;
db.getCollection("tagvalues").find(
{
"TagId" : {
"$in" : [1.0, 2.0]
}
});

index detail

{ 
"v" : NumberInt(1), 
"unique" : true, 
"key" : {
"TagId" : NumberInt(1), 
"LastChangedTime" : NumberInt(1)
}, 
"name" : "TagId_1_LastChangedTime_1", 
"ns" : "local.tagvalues", 
"sparse" : true, 
"2dsphereIndexVersion" : NumberInt(2)
}

It runs on orangePi PC Plus with Linux orangepipcplus 4.14.18-sunxi #24 SMP armv7l GNU/Linux 32 bit

mongo & linux details:

db version v3.2.12 git version: ef3e1bc78e997f0d9f22f45aeb1d8e3b6ac14a14 allocator: system modules: none build environment: distarch: arm target_arch: arm

I built mongo and mongod from source by following this blog post

Environment detail

/usr/local/bin/mongod: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=xyz, not stripped

linux-vdso.so.1 (0xbe877000)
librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xb5bac000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb5b99000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0xb5a8d000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb5a15000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xb59ec000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb59c8000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb58da000)
/lib/ld-linux-armhf.so.3 (0xb6f7f000)

linux2

when in other OS like xenial I upgrade mongod to 3.6.x this issue fixed. While I can't upgrade the mongo on orangePi pc plus from source because mongo didn't support the 32 bit CPUs on a higher version of it


Now any idea how to solve this issue.

Community
  • 1
  • 1
farzam
  • 709
  • 2
  • 6
  • 21
  • 1
    Probably unaligned data access. The older ARM devices do not tolerate it. Report a bug to the mongod folks. You can probably find the bug with the sanitizers. That is, compile with `-fsanitize=address`. The sanitizers will produce a finding for the unaligned access. – jww Jun 21 '18 at 16:22
  • 1
    Since you are building from sources you may be able to catch the problem code at compile time with `-Wcast-align`. It will usually catch the ones that move to/from floats and doubles that are misaligned. It may/may not catch some of the integer violations. Also see [this](https://stackoverflow.com/q/25762173/608639), which older ARM does not tolerate. – jww Jun 21 '18 at 16:36
  • 1
    This looks like it might be related: [Bus Error on Mongodb MongoClient.connect() for Raspberry Pi ARM](https://stackoverflow.com/q/16746134/608639). Is there a `USE_MISALIGNED_MEMORY_ACCESS`, and is it set to `1`? If so, you definitely want to disable it. Don't use unaligned accesses on any hardware, even x86. On tolerant machines like x86 misalgned accesses usually break at `-O3` during GCC vectorization. – jww Jun 21 '18 at 16:43

0 Answers0