-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
docker top fails when large PIDs exceed 5 figures #34282
Comments
|
Actually I tried to reproduce this issue, but I failed with the following output: The PID is And I am wondering why your data is |
|
I'm not really sure. I can see this by hitting the API directly: When I first start my system where the PIDs are below 6 digits: After running a quick for loop to increase the pids: I'm not sure how Docker is exactly getting the list of PIDs but I'm assuming that whatever my system is returning is different than what you're seeing. |
|
A quick update, if someone wants to look into this (don't have time myself at this moment); @mbentley sent me the output of The problem here is that that output (at least by default) glues together the I did a quick search if there's a portable way to change the format, so that we can guarantee that the columns are always separated. This ServerFault discussion provides some possible options; https://serverfault.com/a/157618 However, if there's an option, we need to be sure it's supported on all platforms/distros, given that docker shells out to the The |
|
@thaJeztah I can take a look at this. I just reproduced the problem. |
|
@dccurtis thanks! I'm currently on vacation myself and limited internet access, so feel free to work on it 👍 |
|
Quick update on this. I can reproduce the problem with functional and unit testing. I've spent some time experimenting with changing the output format of the If there is no universal way to re-fromat the host 'ps' output to avoid this problem then the other way to fix this is to detect the Detecting the problem is easy enough: I'm going to start working on the change to add a space between the two columns. If anyone sees any issues with this approach please let me know. |
|
@dccurtis How do you split |
|
Yes, this is where things could get complicated. Assumptions:
For this case, the delimiter with One idea that I'm still working with is that |
|
While I would have much preferred to handle this problem to correct the PID field regardless of what the next column is, I don't think there is a practical way to accomplish this. I haven't been able to find a deterministic way of knowing where the PID ends and the next column's field begins when the next column starts with a number. Instead, I'm focusing on this specific problem, when the next column starts with a letter and the two columns are concatenated. We will always know that this is wrong and can find the delimitation point since the PID will always be a numeric value. I will have a PR out soon to address this. |
|
Are there any updates for this? I ran into this issue a couple days ago with my Jenkins Pipeline using Docker set up. One of the plugins being used is executing |
|
Sorry for the delay on this. I’ll sync my branch and retest my fix. If all goes well I’ll have it out for review soon. |
|
I'm wrapping up the re-running my functional test but am working through some issues I'm having around running Docker on Alpine linux. Once I complete the testing I'll get this out for review. One caveat about my change. I can only correct PID values where the next column starts with a non-numeric character. If the PID+1 column value starts with a number we resort to the pre-existing behavior and it errors out. I couldn't find a generic way of getting only the PID values for all hosts (linux distributions). If anyone has any ideas on how to do that please let me know. That way we could always figure out the correct values for PID and PID+1. |
|
Two quick questions:
|
I think that may actually be a good solution; one other option that may work is to customize the COLUMN-headers; not all variations of
So doing something like; Will make the columns wider, accommodating the underscores; |
|
Seems like Jenkins on Docker for Windows is the use case that triggers this bug for most people, according to the comments here. I experience the same and it is a pain. Would love to see some priority put into this. |
|
I apologize for my silence. I haven't had a lot of cycles lately. :(. I'll dust off my old branch and see if I can incorporate what @thaJeztah suggested, and give it a try on a few distos as a sanity check. If anyone has cycles and experience on the Windows side please feel free to jump in. I don't want the fact that I have a PR out signal to others that this issue is taken. Happy to help; but don't want to turn away others. |
|
For "Docker for Windows" in this case, it's likely "Linux" containers on Docker for Windows (which run in a LinuxKit VM and use busybox, so no Windows-specific fox should be needed for that) |
|
Until there's a proper fix for the parsing in place, can't the Linux VM (mobylinuxvm) just set (on boot) |
|
@rn ^^ would that be an option? |
|
Weirdly for Docker for Mac I've created a PR to set the limit to 99999 for both. Not sure when this will land (ie which release will pick it up) |
|
On windows... @rn pidmax to 131072 on Window? How come the On Docker playground which runs against ubuntu, the same stuff as above works just fine =/ |
|
It's very likely due to a bug/presentation issue in busybox; docker uses the output of |
|
@thaJeztah we could also install |
|
For the time being - those who wish to work around it much like I had, this should work... Start a new privileged throwaway container: Identify if your pid_max is over five digits long: Change it to 99999: This should allow use cases, such as Jenkins running via Docker-in-Docker (on Windows) to work reliably afterwards. |
|
Todays Docker Desktop Edge release should have the fix. Should also be in the next stable release |
|
Thanks Rolf! |
|
@rn how long before the next stable release? |
|
Is there some way we can just avoid the fragile parsing of the |
|
@ijc yes; that's been discussed a few times; i.e., don't use an external binary, but implement our own way to get this information. There's one issue with that, and that's that currently the command accepts options to be passed to |
|
@ehouarn-perret earlier today, i think |
|
Workaround is going smoothly currently. Thanks for getting that in place @rn! |
|
I'm guessing this is fixed by now. |
Description
On a system that supports greater than 5 figures,
docker topon the container will fail due to what appears to be a parsing failure of the returned values:Steps to reproduce the issue:
Check
pid_maxto see if your kernel supports a 6 figures number:Run enough processes to get to large PIDs; I'd expect some sort of
forloop should do this pretty quicklyAttempt to run
docker top:Docker client output:
Describe the results you received:
Did not give me top output
Describe the results you expected:
I should get
docker topoutputAdditional information you deem important (e.g. issue happens only occasionally):
Output of
docker version:Output of
docker info:Additional environment details (AWS, VirtualBox, physical, etc.):
VMware Fusion VM
The text was updated successfully, but these errors were encountered: