Init leaking memory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
upstart |
New
|
Undecided
|
Unassigned |
Bug Description
Hi,
Upstart init will leak a memory, when /var/log/upstart directory was deleted from the system, and some application in init, are writing to console.
We notice this behaviour on one machine, when after 15 days, whole ram was used by process 1 (init).
After creating missing directory '/var/log/upstart', everything go to normal state.
We reproduce the situation like that:
Create silly script noisy-duck.sh
```
#!/bin/bash
while true;
do
echo
echo "Hello, I'm really noisy duck...."
echo "Quack, Quack..."
echo "Quack, Quack..."
echo "Oops, it's (" `date` ") already. Dude, shouldn't you go for a training right now?"
#sleep 10
done
```
And put proper configuration to /etc/init/
```
# test noisy app
description "Noisy duck"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
umask 022
console log
pre-start script
test -x /usr/local/
test -c /dev/null || { stop; exit 0; }
end script
exec /usr/local/
```
and then 'rm -rf /var/log/upstart', and after a few hours our init process in top has a 871MB Ram usage ( you can find a screenshot in attachment)
So after running a strace -p 1, we can observe this error:
read(3, 0x7ffff457e05f, 1) = -1 EAGAIN (Resource temporarily unavailable)
waitid(P_ALL, 0, {}, WNOHANG|
clock_gettime(
select(19, [3 5 6 7 9 10 13 14 15 16 17 18], [], [7 9 10], NULL) = 1 (in [13])
read(13, "Oops, it's ( Fri Mar 16 11:30:56"..., 8192) = 101
read(13, "\r\n\r\n", 8091) = 4
read(13, "Hello, I'm really noisy duck....", 8087) = 32
read(13, "\r\nQuack, Quack...", 8055) = 17
read(13, "\r\nQuack, Quack...\r\n", 8038) = 19
read(13, 0x7fe88cd81f3d, 8019) = -1 EAGAIN (Resource temporarily unavailable)
fstat(-1, 0x7ffff457dd10) = -1 EBADF (Bad file descriptor)
umask(0117) = 0117
open("/
read(3, 0x7ffff457e05f, 1) = -1 EAGAIN (Resource temporarily unavailable)
waitid(P_ALL, 0, {}, WNOHANG|
clock_gettime(
select(19, [3 5 6 7 9 10 13 14 15 16 17 18], [], [7 9 10], NULL) = 1 (in [13])
read(13, "Oops, it's ( Fri Mar 16 11:30:56"..., 8192) = 101
read(13, "\r\n\r\n", 8091) = 4
read(13, "Hello, I'm really noisy duck....", 8087) = 32
read(13, "\r\nQuack, Quack...", 8055) = 17
read(13, "\r\nQuack, Quack...\r\n", 8038) = 19
read(13, 0x7fe88cd81f3d, 8019) = -1 EAGAIN (Resource temporarily unavailable)
fstat(-1, 0x7ffff457dd10) = -1 EBADF (Bad file descriptor)
umask(0117) = 0117
open("/
I suspect the problem is here:
https:/
Because buffor is not cleaned.
At now I'm watching this more deeply, so maybe later I will push a fix for that, but I'm curious about your opinions.