Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU runaway using -f option #20

Closed
hedefalk opened this issue May 5, 2017 · 10 comments
Closed

CPU runaway using -f option #20

hedefalk opened this issue May 5, 2017 · 10 comments
Labels

Comments

@hedefalk
Copy link

hedefalk commented May 5, 2017

I get around 150% CPU running the docker image on Mac with level 2 logging. I think it worked better the other day so maybe something that comes after a while. Hard to debug for me… Will try to use the python version natively instead now…

@hedefalk
Copy link
Author

hedefalk commented May 5, 2017

Follow-up:

I installed via easy_install instead but still got 150% CPU on my Docker process in OSX.

So it turns out it's the MONGO process that get's heavy CPU usage only when tailing it with this tool. (I'm running this Mongo within Docker too)

Still don't know how to debug this well…

@mrsarm
Copy link
Owner

mrsarm commented May 6, 2017

Hello @hedefalk ,

Yes, you are alright, some times when you execute the Mongotail with the -f option, it take a lot of CPU consumption, I had the same issue with two different versions of Linux, but I didn't have time to profile the error to find where is the problem. I think the problem comes from the PyMongo driver, I'll try to profile Mongotail soon.

@mrsarm mrsarm added the bug label May 6, 2017
@mrsarm mrsarm changed the title CPU runaway using Docker on OSX… CPU runaway using -f option May 6, 2017
@mrsarm
Copy link
Owner

mrsarm commented May 23, 2017

@hedefalk,

As I said, I experimented the same issue in the past. Now I'm trying to reproduce again but tailing with the -f option is working Ok, maybe it was solved n the latest PyMongo driver. Which version are you using? Did you try with the latest 3.4.0 version?

My test environment:

  • PyMongo 3.4.0
  • Mongotail 2.1.1
  • MongoDB 3.2.1
  • Ubuntu 14.04 x64
  • Python 2.7 and 3.4

@hedefalk
Copy link
Author

MongoDB: 3.2.12
Python: 2.7.12

PyMongo, not a clue?

OSX 10.12.4. But MongoDB running from official docker image which is debian:jessie I think. I get this behaviour running mongotail as docker image too so should be pretty non-system dependent?

@mrsarm
Copy link
Owner

mrsarm commented May 23, 2017

To se the mongotail version:

mongotail --version

To see the PyMongo version:

python -c 'import pymongo; print pymongo.__version__'

Both versions are not specified in the Dockerfile (should be fixed), so depends of the day you run the first time the Docker container the versions of PyMongo and Mongotail are installed. Running outside docker, execute first sudo pip install --upgrade pymongo or sudo easy_install --upgrade pymongo to update the library to the latest version. Same for Mongotail.

@mrsarm
Copy link
Owner

mrsarm commented May 30, 2017

@hedefalk , I found when the problem happens: it just occurs when you are connecting with local databases. I couldn't reproduce the bug before because I was trying with a remote server, after tried with two different local servers, the problem happened again.

Profiling mongotail I found that the problem looks like a driver issue, so I reported the bug to the PyMongo project: PYTHON-1276.

@hedefalk
Copy link
Author

@mrsarm Cool!

Sorry for not getting back, I seem to have missed this. Here's just for completeness:

~ ❯❯❯ mongotail --version
mongotail 2.1.1 <https://github.com/mrsarm/mongotail>
~ ❯❯❯ python -c 'import pymongo; print pymongo.__version__'
3.4.0

@mrsarm
Copy link
Owner

mrsarm commented May 30, 2017

Patch from @ShaneHarvey works Ok! Please @hedefalk test it. Released in Mongotail 2.1.2

@hedefalk
Copy link
Author

@mrsarm Awesome!

Python noob question, is this published in any of the channels I've used?

~ ❯❯❯ sudo easy_install mongotail
Searching for mongotail
Best match: mongotail 2.1.1
Processing mongotail-2.1.1-py2.7.egg
mongotail 2.1.1 is already the active version in easy-install.pth
Installing mongotail script to /usr/local/bin

Using /usr/local/lib/python2.7/site-packages/mongotail-2.1.1-py2.7.egg
Processing dependencies for mongotail
Finished processing dependencies for mongotail

I've only used this and docker…

@mrsarm
Copy link
Owner

mrsarm commented May 31, 2017

Try this:

~ ❯❯❯ sudo easy_install --upgrade mongotail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants