-
Notifications
You must be signed in to change notification settings - Fork 396
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
PortDumpTest fails if kernel.core_pattern forces the core to be redirected #6300
Comments
Google coredumper (https://code.google.com/archive/p/google-coredumper/) did attempt to do this kind of thing but it's very old. https://github.com/Percona-Lab/coredumper was an attempt at updating it, but it uses various bits of assembler that don't seem to build now. |
The basic issue I'm trying to solve is... in a Kubernetes environment, how can I get a core dump out of a process:
|
With
|
|
My OS:
With With Line 102 in 0234071
omr/port/linux/omrosdump_helpers.c Line 131 in dd1373f
The above functions correctly work with
|
In an OpenShift environment we're more likely to be looking at systemd-coredump rather than Apport. |
This seems a reasonable feature to add, but I suggest it should be opt-in: an application must explicitly indicate that the new mechanism should be used to generate core files (as opposed to allowing the Linux kernel to do that). |
More details on the reasonable feature:
@mikezhang1234567890 While implementing #6014, did you find any resources which will allow us to extend the core dump tool to Linux? |
If we're looking to implement a user-space core dump tool, the basic approach can roughly be the same, dump the memory (of a copy or of the original process), and dump the thread state. Most of the information needed to implement is regarding the binary format, which is ELF on Linux, and documentation is plentiful for ELF. https://www.gabriel.urdhr.fr/2015/05/29/core-file/ is a good read on the basic structure of a core file generated by the kernel or GDB. I don't have anything for challenges or issues specific to Linux unfortunately. |
Particular care would probably need to be made for setuid/setgid executables. The file permissions would probably need to be read just for the owning user of the process? |
Note that there are two common solutions to this:
With that, it would be very nice to have a core-dumper in J9 like on macOS since, 1) most containers don't have |
Thanks @kgibm
|
Yes, you're right, I just tried this and it requires
One could create an
Agreed, and from my experience, most customers have the default |
I can have a try at this. I will initially try to do this with an environment variable or Java option to toggle the behaviour. |
When apport is installed as default coredump handler, if you listen on /run/apport.socket inside the container you can accept coredump from within the container. I have not found any way to do something similar with systemd. |
Running omrporttest if kernel.core_pattern=core.%p (for example), PortDumpTest passes.
If it's something like "|/usr/share/apport/apport %p %s %c %d %P %E" then the core doesn't necessarily get created in the current working directory, and the test fails.
This then raises the point that for this code to work, the user must disable core dump redirection, which is going to be a privileged operation. Even worse, there is no way of setting it within a container unless the container is privileged, meaning that the host has to be changed to get a core dump generated within the container with the specified name. This is described here:
containers/podman#6528
Could the core dump code for Linux be changed to directly generate the file similar to OSX so it wouldn't be affected by core_pattern at all?
The text was updated successfully, but these errors were encountered: