-
Notifications
You must be signed in to change notification settings - Fork 21
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
unicode issues in the logging #25
Comments
Oups, that's a bad one |
see also rfjakob/earlyoom#110 Handle line with unicode:
|
We're already doing decode there ... at least in master branch): ## TODO: we should fetch this information from /proc filesystem instead of using ps
info = check_output("ps -p %d uf" % pid, shell = True).decode('utf-8') |
The decode is there in the v0.12.1 revision as well, though it was not there in the original pull-request. It was apparently introduced in pull request #6, 2016. So unless you're running a very old version of thrash-protect, the issue must be somewhere else. I should try and see if I can reproduce the issue. |
...without 'ignore'. Please use
I used the latest version. I cloned it today. |
I've fixed the ignore, but I don't believe that will help. Is there any difference if you run it under python2 or python3? |
I added 'ignore' and it doesn't help.
It needs multiple fixes. |
Instead of |
Bad idea: AttributeError: 'str' object has no attribute 'decode'. |
The character set should be given when opening the file. However, as I read the error above it assumes UTF-8, but carps because the file is not valid UTF8. I will need to try to reproduce this charset problems somehow. |
How does a typical non-ascii /proc/*/stat file look for you? |
the only thing there that is non-numeric is the process name. I'll see if I can spawn up a process locally that has a non-ascii name. |
it works with python and python3
|
Rename memory hog to ПАГПАВОНАВЧАОНАЛ and execute it. |
|
need to handle next
|
I guess the problem is a bit further up ...
|
I believe it should work now. Tested at my end at least, without problems. |
oh, except now things are breaking under python2 |
and now there are test breakages |
unit tests mended, ref c56ba65 |
I've been digging a bit more into this - I'd say it could almost be classified as a kernel bug. In the stat file, long command names are truncated - and in this case, the truncation happens right in a UTF-8 character. The Ш-character is two bytes long in UTF-8, d0a8 - but the truncation happens between d0 and a8. Hence the decode('utf-8') without the ignore-flag will indeed break. I had forgotten we actually had unit tests in place, I'll make sure to include this process name in the test code. |
thrash-protect freezed my browser and crashed:
The text was updated successfully, but these errors were encountered: