3

I get this error, when I login via SSH, to my pi, but it appears to be fully functioning.

error pid:15354, boost::interprocess::bad_alloc

1) Is it to do with a memory problem? 2) Should I be concerned? 3) How do I go about understanding and thus fixing it?

I've Googled around and it seems very complex; can someone try and explain what it is, to someone who has limited understanding of memory issues, under the hood, of this lovely little black box!

Further information based on Goldiloxcks comments:

a)at login this morning I got:

error pid:20314, boost::interprocess::bad_alloc
error pid:20315, boost::interprocess::bad_alloc
error pid:20313, boost::interprocess::bad_alloc
error pid:20317, boost::interprocess::bad_alloc
error pid:20319, boost::interprocess::bad_alloc
error pid:20324, boost::interprocess::bad_alloc
error pid:20326, boost::interprocess::bad_alloc

It appears to happen after every command executed, and every time I log in.

b) sudo grep "oom-killer" /var/log/* gives:

grep: /var/log/apt: Is a directory
/var/log/auth.log:Dec 10 09:55:26 raspberrypi sudo:       pi : TTY=pts/0 ; PWD=/home/pi ; USER=                                                                                                      root ; COMMAND=/bin/grep oom-killer /var/log/alternatives.log /var/log/alternatives.log.1 /var/                                                                                                      log/apt /var/log/auth.log /var/log/auth.log.1 /var/log/auth.log.2.gz /var/log/auth.log.3.gz /va                                                                                                      r/log/auth.log.4.gz /var/log/bootstrap.log /var/log/btmp /var/log/btmp.1 /var/log/ConsoleKit /v                                                                                                      ar/log/daemon.log /var/log/daemon.log.1 /var/log/daemon.log.2.gz /var/log/daemon.log.3.gz /var/                                                                                                      log/daemon.log.4.gz /var/log/debug /var/log/debug.1 /var/log/debug.2.gz /var/log/debug.3.gz /va                                                                                                      r/log/debug.4.gz /var/log/dmesg /var/log/dmesg.0 /var/log/dmesg.1.gz /var/log/dmesg.2.gz /var/l                                                                                                      og/dmesg.3.gz /var/log/dmesg.4.gz /var/log/dpkg.log /var/log/dpkg.log.1 /var/log/faillog /var/l                                                                                                      og/fontconfig.log /var/log/fsck /var/log/kern.log /var/log/kern.log.1 /var/log/kern.log.2.gz /v                                                                                                      ar/log/kern.log.3.gz /var/log/kern.log.4.gz /var/log/lastlog /var/log/lpr.log /var/log/mail.err                                                                                                       /var/log/mail.info /var/log/mail.log /var/log/mail.warn
/var/log/auth.log:Dec 10 09:55:55 raspberrypi sudo:       pi : TTY=pts/0 ; PWD=/home/pi ; USER=                                                                                                      root ; COMMAND=/bin/grep oom-killer /var/log/alternatives.log /var/log/alternatives.log.1 /var/                                                                                                      log/apt /var/log/auth.log /var/log/auth.log.1 /var/log/auth.log.2.gz /var/log/auth.log.3.gz /va                                                                                                      r/log/auth.log.4.gz /var/log/bootstrap.log /var/log/btmp /var/log/btmp.1 /var/log/ConsoleKit /v                                                                                                      ar/log/daemon.log /var/log/daemon.log.1 /var/log/daemon.log.2.gz /var/log/daemon.log.3.gz /var/                                                                                                      log/daemon.log.4.gz /var/log/debug /var/log/debug.1 /var/log/debug.2.gz /var/log/debug.3.gz /va                                                                                                      r/log/debug.4.gz /var/log/dmesg /var/log/dmesg.0 /var/log/dmesg.1.gz /var/log/dmesg.2.gz /var/l                                                                                                      og/dmesg.3.gz /var/log/dmesg.4.gz /var/log/dpkg.log /var/log/dpkg.log.1 /var/log/faillog /var/l                                                                                                      og/fontconfig.log /var/log/fsck /var/log/kern.log /var/log/kern.log.1 /var/log/kern.log.2.gz /v                                                                                                      ar/log/kern.log.3.gz /var/log/kern.log.4.gz /var/log/lastlog /var/log/lpr.log /var/log/mail.err                                                                                                       /var/log/mail.info /var/log/mail.log /var/log/mail.warn
/var/log/auth.log:Dec 10 10:06:30 raspberrypi sudo:       pi : TTY=pts/0 ; PWD=/home/pi ; USER=                                                                                                      root ; COMMAND=/bin/grep oom-killer /var/log/alternatives.log /var/log/alternatives.log.1 /var/                                                                                                      log/apt /var/log/auth.log /var/log/auth.log.1 /var/log/auth.log.2.gz /var/log/auth.log.3.gz /va                                                                                                      r/log/auth.log.4.gz /var/log/bootstrap.log /var/log/btmp /var/log/btmp.1 /var/log/ConsoleKit /v                                                                                                      ar/log/daemon.log /var/log/daemon.log.1 /var/log/daemon.log.2.gz /var/log/daemon.log.3.gz /var/                                                                                                      log/daemon.log.4.gz /var/log/debug /var/log/debug.1 /var/log/debug.2.gz /var/log/debug.3.gz /va                                                                                                      r/log/debug.4.gz /var/log/dmesg /var/log/dmesg.0 /var/log/dmesg.1.gz /var/log/dmesg.2.gz /var/l                                                                                                      og/dmesg.3.gz /var/log/dmesg.4.gz /var/log/dpkg.log /var/log/dpkg.log.1 /var/log/faillog /var/l                                                                                                      og/fontconfig.log /var/log/fsck /var/log/kern.log /var/log/kern.log.1 /var/log/kern.log.2.gz /v                                                                                                      ar/log/kern.log.3.gz /var/log/kern.log.4.gz /var/log/lastlog /var/log/lpr.log /var/log/mail.err                                                                                                       /var/log/mail.info /var/log/mail.log /var/log/mail.warn
/var/log/auth.log:Dec 10 10:06:41 raspberrypi sudo:       pi : TTY=pts/0 ; PWD=/home/pi ; USER=                                                                                                      root ; COMMAND=/bin/grep oom-killer /var/log/alternatives.log /var/log/alternatives.log.1 /var/                                                                                                      log/apt /var/log/auth.log /var/log/auth.log.1 /var/log/auth.log.2.gz /var/log/auth.log.3.gz /va                                                                                                      r/log/auth.log.4.gz /var/log/bootstrap.log /var/log/btmp /var/log/btmp.1 /var/log/ConsoleKit /v                                                                                                      ar/log/daemon.log /var/log/daemon.log.1 /var/log/daemon.log.2.gz /var/log/daemon.log.3.gz /var/                                                                                                      log/daemon.log.4.gz /var/log/debug /var/log/debug.1 /var/log/debug.2.gz /var/log/debug.3.gz /va                                                                                                      r/log/debug.4.gz /var/log/dmesg /var/log/dmesg.0 /var/log/dmesg.1.gz /var/log/dmesg.2.gz /var/l                                                                                                      og/dmesg.3.gz /var/log/dmesg.4.gz /var/log/dpkg.log /var/log/dpkg.log.1 /var/log/faillog /var/l                                                                                                      og/fontconfig.log /var/log/fsck /var/log/kern.log /var/log/kern.log.1 /var/log/kern.log.2.gz /v                                                                                                      ar/log/kern.log.3.gz /var/log/kern.log.4.gz /var/log/lastlog /var/log/lpr.log /var/log/mail.err                                                                                                       /var/log/mail.info /var/log/mail.log /var/log/mail.warn
/var/log/auth.log:Dec 10 10:13:06 raspberrypi sudo:       pi : TTY=pts/0 ; PWD=/home/pi ; USER=                                                                                                      root ; COMMAND=/bin/grep oom-killer /var/log/alternatives.log /var/log/alternatives.log.1 /var/                                                                                                      log/apt /var/log/auth.log /var/log/auth.log.1 /var/log/auth.log.2.gz /var/log/auth.log.3.gz /va                                                                                                      r/log/auth.log.4.gz /var/log/bootstrap.log /var/log/btmp /var/log/btmp.1 /var/log/ConsoleKit /v                                                                                                      ar/log/daemon.log /var/log/daemon.log.1 /var/log/daemon.log.2.gz /var/log/daemon.log.3.gz /var/                                                                                                      log/daemon.log.4.gz /var/log/debug /var/log/debug.1 /var/log/debug.2.gz /var/log/debug.3.gz /va                                                                                                      r/log/debug.4.gz /var/log/dmesg /var/log/dmesg.0 /var/log/dmesg.1.gz /var/log/dmesg.2.gz /var/l                                                                                                      og/dmesg.3.gz /var/log/dmesg.4.gz /var/log/dpkg.log /var/log/dpkg.log.1 /var/log/faillog /var/l                                                                                                      og/fontconfig.log /var/log/fsck /var/log/kern.log /var/log/kern.log.1 /var/log/kern.log.2.gz /v                                                                                                      ar/log/kern.log.3.gz /var/log/kern.log.4.gz /var/log/lastlog /var/log/lpr.log /var/log/mail.err                                                                                                       /var/log/mail.info /var/log/mail.log /var/log/mail.warn
grep: /var/log/ConsoleKit: Is a directory
grep: /var/log/fsck: Is a directory
grep: /var/log/news: Is a directory
grep: /var/log/ntpstats: Is a directory
grep: /var/log/samba: Is a directory
grep: /var/log/unattended-upgrades: Is a directory

c) lsof /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 gives:

-bash: lsof: command not found

d) sudo grep -P "[^\.\d\[]20314" /var/log/* gives:

grep: /var/log/apt: Is a directory
/var/log/auth.log:Dec 10 10:03:03 raspberrypi sudo:       pi : TTY=pts/0 ; PWD=/                                                                                                                     home/pi ; USER=root ; COMMAND=/bin/grep -P [^\.\d\[]20314 /var/log/alternatives.                                                                                                                     log /var/log/alternatives.log.1 /var/log/apt /var/log/auth.log /var/log/auth.log                                                                                                                     .1 /var/log/auth.log.2.gz /var/log/auth.log.3.gz /var/log/auth.log.4.gz /var/log                                                                                                                     /bootstrap.log /var/log/btmp /var/log/btmp.1 /var/log/ConsoleKit /var/log/daemon                                                                                                                     .log /var/log/daemon.log.1 /var/log/daemon.log.2.gz /var/log/daemon.log.3.gz /va                                                                                                                     r/log/daemon.log.4.gz /var/log/debug /var/log/debug.1 /var/log/debug.2.gz /var/l                                                                                                                     og/debug.3.gz /var/log/debug.4.gz /var/log/dmesg /var/log/dmesg.0 /var/log/dmesg                                                                                                                     .1.gz /var/log/dmesg.2.gz /var/log/dmesg.3.gz /var/log/dmesg.4.gz /var/log/dpkg.                                                                                                                     log /var/log/dpkg.log.1 /var/log/faillog /var/log/fontconfig.log /var/log/fsck /                                                                                                                     var/log/kern.log /var/log/kern.log.1 /var/log/kern.log.2.gz /var/log/kern.log.3.                                                                                                                     gz /var/log/kern.log.4.gz /var/log/lastlog /var/log/lpr.log /var/log/mail.err /v                                                                                                                     ar/log/mail.info /var/log/mail.log /var/log/mail.war
/var/log/auth.log:Dec 10 10:03:13 raspberrypi sudo:       pi : TTY=pts/0 ; PWD=/                                                                                                                     home/pi ; USER=root ; COMMAND=/bin/grep -P [^\.\d\[]20314 /var/log/alternatives.                                                                                                                     log /var/log/alternatives.log.1 /var/log/apt /var/log/auth.log /var/log/auth.log                                                                                                                     .1 /var/log/auth.log.2.gz /var/log/auth.log.3.gz /var/log/auth.log.4.gz /var/log                                                                                                                     /bootstrap.log /var/log/btmp /var/log/btmp.1 /var/log/ConsoleKit /var/log/daemon                                                                                                                     .log /var/log/daemon.log.1 /var/log/daemon.log.2.gz /var/log/daemon.log.3.gz /va                                                                                                                     r/log/daemon.log.4.gz /var/log/debug /var/log/debug.1 /var/log/debug.2.gz /var/l                                                                                                                     og/debug.3.gz /var/log/debug.4.gz /var/log/dmesg /var/log/dmesg.0 /var/log/dmesg                                                                                                                     .1.gz /var/log/dmesg.2.gz /var/log/dmesg.3.gz /var/log/dmesg.4.gz /var/log/dpkg.                                                                                                                     log /var/log/dpkg.log.1 /var/log/faillog /var/log/fontconfig.log /var/log/fsck /                                                                                                                     var/log/kern.log /var/log/kern.log.1 /var/log/kern.log.2.gz /var/log/kern.log.3.                                                                                                                     gz /var/log/kern.log.4.gz /var/log/lastlog /var/log/lpr.log /var/log/mail.err /v                                                                                                                     ar/log/mail.info /var/log/mail.log /var/log/mail.war
/var/log/auth.log:Dec 10 10:16:17 raspberrypi sudo:       pi : TTY=pts/0 ; PWD=/                                                                                                                     home/pi ; USER=root ; COMMAND=/bin/grep -P [^\.\d\[]20314 /var/log/alternatives.                                                                                                                     log /var/log/alternatives.log.1 /var/log/apt /var/log/auth.log /var/log/auth.log                                                                                                                     .1 /var/log/auth.log.2.gz /var/log/auth.log.3.gz /var/log/auth.log.4.gz /var/log                                                                                                                     /bootstrap.log /var/log/btmp /var/log/btmp.1 /var/log/ConsoleKit /var/log/daemon                                                                                                                     .log /var/log/daemon.log.1 /var/log/daemon.log.2.gz /var/log/daemon.log.3.gz /va                                                                                                                     r/log/daemon.log.4.gz /var/log/debug /var/log/debug.1 /var/log/debug.2.gz /var/l                                                                                                                     og/debug.3.gz /var/log/debug.4.gz /var/log/dmesg /var/log/dmesg.0 /var/log/dmesg                                                                                                                     .1.gz /var/log/dmesg.2.gz /var/log/dmesg.3.gz /var/log/dmesg.4.gz /var/log/dpkg.                                                                                                                     log /var/log/dpkg.log.1 /var/log/faillog /var/log/fontconfig.log /var/log/fsck /                                                                                                                     var/log/kern.log /var/log/kern.log.1 /var/log/kern.log.2.gz /var/log/kern.log.3.                                                                                                                     gz /var/log/kern.log.4.gz /var/log/lastlog /var/log/lpr.log /var/log/mail.err /v                                                                                                                     ar/log/mail.info /var/log/mail.log /var/log/mail.war
grep: /var/log/ConsoleKit: Is a directory
grep: /var/log/fsck: Is a directory
grep: /var/log/news: Is a directory
grep: /var/log/ntpstats: Is a directory
grep: /var/log/samba: Is a directory
grep: /var/log/unattended-upgrades: Is a directory

===========================================================

e) After installing lsof sudo apt-get install lsof

and running the command: lsof /usr/lib/arm-linux-gnueabihf/libstdc++.so.6

I get:

error pid:27217, boost::interprocess::bad_alloc
COMMAND   PID USER  FD   TYPE DEVICE SIZE/OFF  NODE NAME
bash    26927   pi mem    REG  179,2   800736 28783 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6                                                                                                      .0.19
lsof    27217   pi mem    REG  179,2   800736 28783 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6                                                                                                      .0.19
lsof    27218   pi mem    REG  179,2   800736 28783 /usr/lib/arm-linux-gnueabihf/libstdc++.so.6                                                                                                      .0.19

f) free gives:

error pid:27109, boost::interprocess::bad_alloc              total       used       free     shared    buffers     cached Mem:        382840     265092     117748          0      71008     133908 -/+ buffers/cache:      60176     322664 Swap:       102396          0     102396

g) After chaining the prompt using PS1="> " I then did ls which I get the correct result but with this error too:error pid:27177, boost::interprocess::bad_alloc

Does this hint at a solution?

1
  • On raspbian, apt-get install lsof to use lsof; this will list programs that have a certain file open. I do not think it is a memory issue, you could double check that with free when you first log in. You could also try ps -p with the pids, but I'd guess they are dead by then. Someone here a while back had something weird installed to run via the prompt that caused problems like this. Try PS1="> ". That will change your prompt until next login; if it makes a difference there's another clue.
    – goldilocks
    Dec 10, 2014 at 15:38

1 Answer 1

1

It's an error from a boost library. This is good to know because that means it's not ssh itself, which is written in C and would not have a dependency on boost.

1) Is it to do with a memory problem?

Possibly, since the standard C++ bad_alloc indicates a request for memory which was denied. Those are actually not easy to make (i.e., it's hard to make a request that will be denied); on linux it's by default almost impossible, in fact, since what the system does is always say yes, then when it runs out of RAM, it just picks a process and kills it. There are some exceptions to that, but you pretty much have to invoke them on purpose or have a truly wicked bug.

You can check to see if that's happened with sudo grep oom /var/log/*. You're looking for references to the "OOM killer" (OOM = out-of-memory). If this turns up too much obviously unrelated garbage, narrow it down with sudo grep "oom-killer" /var/log/*, since last I saw it that's exactly the term the kernel used. The line will read something like:

kernel: foobar invoked oom-killer ...

Where foobar is the name of a process that triggered what's about to happen in the log. It is not, however, necessarily the process that was killed, or the "guilty" process (if there is one). But it would indicate a problem -- this should not happen often especially on a (presumably mostly idle) headless unit.

My hunch though is that since this is actually a boost derived version of the standard bad_alloc, it has some alternate significance which does not represent any problem for the system generally. From the API docs:

This is the exception thrown by named interprocess_semaphore when a deadlock situation is detected or when an error is detected in the post/wait operation This is the exception thrown by synchronization objects when there is an error in a wait() function This exception is thrown when a named object is created in "open_only" mode and the resource was not already created This exception is thrown when a memory request can't be fulfilled.

So there's three additional reasons for this that have to do with interprocess communication, which makes sense. Those three reasons may have negative consequences for the application involved, but probably don't indicate any wider issue (as a failed memory request would).

You can have a look at the list of processes currently using the C++ base library with:

lsof /usr/lib/arm-linux-gnueabihf/libstdc++.so.6

The process name is in the left column. There may not be any. The base system itself doesn't use C++, so the list should be short. If it isn't, you could narrow this down by looking at the boost lib, but I'm not sure of the path for that.

2) Should I be concerned?

If it turns out there's a rich history of oom killing going on in the logs, yes. You'd want to find out why. When the system gets to that point, it is usually not very responsive or functional for a period of time.

If there isn't, this is not necessarily a big deal.

3) How do I go about understanding and thus fixing it?

The next time you see it, find out what process it is. Fortunately, there's a pid in the message (pid:15354), so the name and some other details can be elicited with:

ps -lp 15354

There's a chance it won't exist at that point. If so you might try sudo grep -P "[^\.\d\[]15354" /var/log/*. The point of the -P is to allow perl style regular expressions, and [^\.\d\[]15354 will look for 15354 but exclude matches preceeded by a ., a numeral, or a [. Otherwise you will likely get a slew of kernel timestamps in the output.

Something should come up there. As a matter of fact, if that's literally the last error message you saw (i.e., you have a record of the actual pid), you could try searching now to see if any record was left from that event.

2
  • you say "you could try searching now to see if any record was left from that event.", Im not sure how to do that, could you please advise, Thanks.
    – reggie
    Dec 10, 2014 at 10:36
  • Using the exact same grep command, if you know what the actual pid was. However, if there was nothing about the oom killer, I'm fairly certain it wasn't a system wide memory issue, so there might be nothing at all in those logs.
    – goldilocks
    Dec 10, 2014 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.