influxdb icon indicating copy to clipboard operation
influxdb copied to clipboard

[0.9.6.1] Memory leak?

Open Samuel1989 opened this issue 10 years ago • 16 comments

Hey upgraded to 0.9.6.1 today but there appears to be a memory leak.

I have a relatively small setup with about 20-30 measurements, once I upgraded it worked fine for about five minutes before running out of memory and then grinding to a half. This was working fine on 0.9.1 with the exact same data.

does anyone know when this was introduced? I will back port to a stable version for now.

Thank you, Sam

Samuel1989 avatar Dec 17 '15 14:12 Samuel1989

Hello Sam,

I have 0.9.6.1(or 0.9.6) up and running and have been for some time. I even ingested quite a lot of data into it. I admit, it was single batch script, but still. However, I'm not seeing any OOM problems. I'm fairly sure it'd help to say which storage engine you're using and perhaps even show the data which you are putting in.

Good luck :) OOM sounds bad.

zstyblik avatar Dec 18 '15 08:12 zstyblik

You might be right:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1294 root 20 0 5289904 1.103g 91784 S 0.0 18.8 542:13.78 influxd 12899 root 20 0 22.551g 120812 63964 S 0.3 2.0 1:21.11 influxd

Mem is slowly going up for PID#12899 and there is only Telegraf sending data in. Whether this is normal or not, that's hard to say. But 22G of VIRT?

zstyblik avatar Dec 18 '15 13:12 zstyblik

@zstyblik I reverted back to 0.9.2.1 and the memory on the box has stopped increasing...

Sam

Samuel1989 avatar Dec 18 '15 16:12 Samuel1989

@Samuel1989 as I've said, please, provide more information about storage engine and data you've inserted to developers. I'm not seeing the same pattern. Actually, it seems like 0.1% got freed by the influxdb(PID#12899) now. So, this might be rather specific thing.

zstyblik avatar Dec 18 '15 17:12 zstyblik

@zstyblik

I am not quite sure what you mean by storage engine? This is a vanilla set up of influxdb (I am not sure what the underlying default engine is).

I am inserting metrics from a number of different servers (4/5) on a staggered schedule of every five minutes.

Sam

Samuel1989 avatar Dec 21 '15 12:12 Samuel1989

For 0.9.2 the only storage engine available was b1. For 0.9.6, the default is bz1 unless otherwise specified, so I think we can assume those are the two at play.

@Samuel1989 it is possible that the RAM usage is not a memory leak but a one-time startup cost as the system reprocesses the older shard files. Can you temporarily increase the available RAM to see if it succeeds?

beckettsean avatar Dec 21 '15 22:12 beckettsean

@beckettsean what's meaning of reprocesses , i thought it was caused by mmap of boltdb.

CrazyJvm avatar Jan 04 '16 09:01 CrazyJvm

@CrazyJvm I honestly don't know all of the internal details. I believe that on startup each shard must be scanned to build the in-RAM index, since there is no one central place where that information is otherwise stored.

beckettsean avatar Jan 04 '16 20:01 beckettsean

FWIW, we are seeing a leak in 0.9.6.1 as well. Certain queries I've run have definitely caused influxdb to fire the OOM killer. We are using the default storage engine.

nmajeran avatar Jan 05 '16 16:01 nmajeran

@nmajeran a query that selects too much data for the available RAM isn't a memory leak, it's a query that is too intense for the available resources. The system doesn't yet have a way of limiting the RAM available for a query, so the process attempts to complete right up until OOM-killer takes it down.

beckettsean avatar Jan 05 '16 19:01 beckettsean

Sorry, my initial post may have been a bit vague. It was a query that returned successfully several times, but became slower with each successive call, until the influxd process was killed by OOM. I only have 7GB of data stored in Influx currently... even at 8x it shouldn't cause a 128GB box to activate OOM...?

nmajeran avatar Jan 05 '16 20:01 nmajeran

@nmajeran I've been experiencing OOM these days with 32GB RAM. it seems we have to wait until finish refactoring query engine.

CrazyJvm avatar Jan 06 '16 14:01 CrazyJvm

So I think I've corralled my problem at least. I was sending data to Influx (letting influx stamp it) with two tags, one of which was unique. I had issues with Influx discarding or deduping the data unless I had that unique tag. I refactored things such that the data would be stamped before it was sent to Influx, and the unique tag was just another data field. After I made those changes, memory usage is much lower on influxd over all, and my queries actually return.

nmajeran avatar Jan 14 '16 14:01 nmajeran

@nmajeran Thanks for the update.

All of the issues discussed here should be resolved using TSM on the most recent 0.10.x releases, and should be even better with 0.11.0 which is currently available in the nightly builds and will be released as an RC next week.

toddboom avatar Mar 09 '16 17:03 toddboom

This issue seems to be there in 0.11 and 0.12 as well

Here is the /var/log/messages snippet

Apr 26 08:08:31 cisco-iox-fog-director-1 kernel: [7359033.064569] Out of memory: Kill process 25444 (influxd) score 867 or sacrifice child Apr 26 08:08:31 cisco-iox-fog-director-1 kernel: [7359033.064629] Killed process 25444 (influxd) total-vm:31725612kB, anon-rss:4889636kB, file-rss:0kB

Attached influx diagnostic and stats influx_diagnostics influx_stats

mehar avatar Apr 26 '16 12:04 mehar

@mehar please open a new issue rather than commenting on an old one related to 0.9.6.

beckettsean avatar Apr 26 '16 17:04 beckettsean