brash-air-25337
12/19/2023, 10:23 PMcmdstanr.install_cmdstan() line:
from metaflow import FlowSpec, step, pypi#, environment
import os
class MinimumFlow(FlowSpec):
@step
def start(self):
self.next(self.install)
# @environment(vars={'GITHUB_PAT': os.getenv('GITHUB_PAT')})
@pypi(python='3.9.18', packages = {'numpy': '1.26.2', 'pandas': '1.5.3',
'rpy2': '3.5.14', 'cmdstanpy': '1.2.0',
'rpy2-arrow': '0.0.8'})
@step
def install(self):
print("Installing packages")
from rpy2.robjects.packages import importr
os.environ['R_REMOTES_STANDALONE'] = "true"
utils = importr('utils')
utils.chooseCRANmirror(ind=1)
print("Installing remotes")
utils.install_packages('remotes')
remotes = importr('remotes')
print("Installing cmdstanr")
remotes.install_github('stan-dev/cmdstanr', force = True)
cmdstanr = importr('cmdstanr')
print("Checking cmdstan requirements")
cmdstanr.check_cmdstan_toolchain()
print("Installing cmdstan")
cmdstanr.install_cmdstan()
print("Packages installed")
self.next(self.end)
@step
def end(self):
print("Flow is done!")
if __name__ == "__main__":
MinimumFlow()average-beach-28850
12/19/2023, 10:39 PMaverage-beach-28850
12/19/2023, 10:41 PMkubectl get events ...brash-air-25337
12/19/2023, 11:23 PMis there anything about OOM kill in pod status in k8s?Not that I can find, but it's possible I am missing where to look. The relevant part of the
describe output:
State: Terminated
Reason: Error
Exit Code: 137
Started: Tue, 19 Dec 2023 18:06:01 -0500
Finished: Tue, 19 Dec 2023 18:06:14 -0500
Ready: False
Restart Count: 0
Limits:
<http://nvidia.com/gpu|nvidia.com/gpu>: 0
Requests:
cpu: 5
ephemeral-storage: 10240M
memory: 48G
<http://nvidia.com/gpu|nvidia.com/gpu>: 0
In the events, I don't see that much of interest in the argo namespace:
m41s Normal SuccessfulCreate Job/t-bc04f3b3-f66qf Created pod: t-bc04f3b3-f66qf-6xfrq
8m40s Normal Pulled Pod/t-bc04f3b3-f66qf-6xfrq Successfully pulled image "xxxx" in 712.62461ms (712.640234ms including waiting)
8m40s Normal Created Pod/t-bc04f3b3-f66qf-6xfrq Created container sample-posterior
8m40s Normal Started Pod/t-bc04f3b3-f66qf-6xfrq Started container sample-posterior
8m24s Warning BackoffLimitExceeded Job/t-bc04f3b3-f66qf Job has reached the specified backoff limit
However, possibly relevant entries in the default namespace:
LAST SEEN TYPE REASON OBJECT MESSAGE
34m (x24 over 5d18h) Warning NodeSysctlChange Node/gke-gke-metaflow-defau-highcpu-pool-2-49461fa8-nlrp {"unmanaged": {"net.netfilter.nf_conntrack_buckets": "491520"}}
104s (x1488 over 6d4h) Warning FailedCreate Job/t-b1ea2d75-qgtfw Error creating: pods "t-b1ea2d75-qgtfw-" is forbidden: error looking up service account default/gsa-metaflow-default: serviceaccount "gsa-metaflow-default" not found
although, this may be very old; that pod is not found when I search for it.
The kubectl logs output:
Setting up task environment.
Downloading code package...
Code package downloaded.
Task is starting.
Compiling model
R[write to console]: Compiling Stan program...
bash: line 1: 59 Killed ( python -u sfflow.py --quiet --metadata service --environment pypi --datastore gs --event-logger nullSidecarLogger --monitor nullSidecarMonitor --datastore-root <gs://storage-genflow-dev-metaflow-default/tf-full-stack-sysroot> --with 'conda:packages={},python=3.9.18,disabled=True' --package-suffixes .py,.R,.RDS --pylint step sample_posterior --run-id 438 --task-id 2247 --input-paths ${METAFLOW_INPUT_PATHS_0} --retry-count 0 --max-user-code-retries 0 --namespace user:jburos ) >> >(python -m metaflow.mflog.tee task $MFLOG_STDOUT) 2>> >(python -m metaflow.mflog.tee task $MFLOG_STDERR 1>&2)average-beach-28850
12/19/2023, 11:27 PMaverage-beach-28850
12/19/2023, 11:27 PMbrash-air-25337
12/19/2023, 11:28 PMaverage-beach-28850
12/19/2023, 11:29 PMstrace -f to try to find out what sends SIGKILL, but strace is not available on linux, and kind of pain to set it up in k8s 🤔brash-air-25337
12/19/2023, 11:31 PMbrash-air-25337
12/20/2023, 4:52 AM[pid 56181] chdir("/home/user/test-metaflow") = 0
[pid 56181] execve("/home/user/miniforge3/envs/metaflow_82db68c0b2834dbfdbaea4c23d61a69d8c84e59b_14d35bb411b822d746acce13a3203ec165b5e890/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/home/user/.cache/pypoetry/virtualenvs/test-metaflow-7ZfJ0mGB-py3.10/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/home/user/miniforge3/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/home/user/.local/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/opt/code-oss/bin/remote-cli/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/home/user/.local/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/home/user/.local/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/usr/local/sbin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/usr/local/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/usr/sbin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/usr/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/sbin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/usr/local/go/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/usr/local/go/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/usr/local/go/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] execve("/usr/local/go/bin/wsl", ["wsl", "uname"], 0x5704401458b0 /* 77 vars */) = -1 ENOENT (No such file or directory)
[pid 56181] write(12, "\376\377\377\377", 4) = 4
[pid 55354] <... read resumed>"\376\377\377\377", 4) = 4
[pid 56181] rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], [], 8) = 0
[pid 55354] wait4(56181, <unfinished ...>
[pid 56181] getpid() = 56181
[pid 56181] gettid() = 56181
[pid 56181] tgkill(56181, 56181, SIGKILL) = ?
[pid 56181] +++ killed by SIGKILL +++
[pid 55354] <... wait4 resumed>[{WIFSIGNALED(s) && WTERMSIG(s) == SIGKILL}], 0, NULL) = 56181
[pid 55354] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=56181, si_uid=1000, si_status=SIGKILL, si_utime=0, si_stime=0} ---
[pid 55354] wait4(56181, 0x7fffa997d6b4, WNOHANG, NULL) = -1 ECHILD (No child processes)
[pid 55354] rt_sigreturn({mask=[]}) = 56181
[pid 55354] close(11) = 0
[pid 55484] <... clock_nanosleep resumed>NULL) = 0
[pid 55484] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=200000000}, <unfinished ...>
[pid 55354] rt_sigprocmask(SIG_BLOCK, [CHLD], NULL, 8) = 0
[pid 55354] wait4(0, 0x7fffa99471c4, WNOHANG, NULL) = 0
[pid 55354] kill(0, SIGKILLKilled
More available here: https://gist.github.com/jburos/8df4f05e5502a37178e5a30b22f7c068
Any thoughts? This output is from a run of the possibly-reproducible example I gave (the modified MinimumFlow)average-beach-28850
12/20/2023, 5:11 AMwsl stuff is weird, i think its actually looking for windows wsl thingyaverage-beach-28850
12/20/2023, 5:12 AMstrace -f /path/to/python ... instead of just python, to make it capture everythingaverage-beach-28850
12/20/2023, 5:18 AMwsl uname and then kills the process doing wsl. Though I don't see why it would kill the entire thing. And how it would get to this code in the first placeaverage-beach-28850
12/20/2023, 5:19 AMbrash-air-25337
12/20/2023, 5:19 AMwsl.
I ran it like this: strace -f poetry run python ....average-beach-28850
12/20/2023, 5:22 AMstrace -f /path/to/python/binary flow.py ... just in case, if you do strace -f poetry run python .. I worry if strace will follow the correct process tree, I think I ran into some issues with this in the pastbrash-air-25337
12/20/2023, 5:52 AMvirtualenv question, I just re-used the one poetry creates by calling that python binary. I don't know if this will re-create the issues you remember, but this should be the same as creating a new virtualenv.
I also modified the installation to use the cmdstanr ref v0.6.1.
Under these conditions, I don't think the trace is very different:
[pid 80590] close(193) = -1 EBADF (Bad file descriptor)
[pid 80590] close(194) = -1 EBADF (Bad file descriptor)
[pid 80590] close(195) = -1 EBADF (Bad file descriptor)
[pid 80590] close(196) = -1 EBADF (Bad file descriptor)
[pid 80590] close(197) = -1 EBADF (Bad file descriptor)
[pid 80590] close(198) = -1 EBADF (Bad file descriptor)
[pid 80590] close(199) = -1 EBADF (Bad file descriptor)
[pid 80590] close(200) = -1 EBADF (Bad file descriptor)
[pid 80590] close(201) = -1 EBADF (Bad file descriptor)
[pid 80590] chdir("/home/user/test-metaflow") = 0
[pid 80590] execve("/home/user/miniforge3/envs/metaflow_676a7146461c6557920547668cc3268d7ebd4f4e_ef98d3ee74b3b0660c6e9f3d80b1b4a016c1290d/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/home/user/miniforge3/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/home/user/.local/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/opt/code-oss/bin/remote-cli/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/home/user/.local/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/home/user/.local/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/usr/local/sbin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/usr/local/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/usr/sbin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/usr/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/sbin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/usr/local/go/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/usr/local/go/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/usr/local/go/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] execve("/usr/local/go/bin/wsl", ["wsl", "uname"], 0x5c9e16169010 /* 76 vars */) = -1 ENOENT (No such file or directory)
[pid 80590] write(12, "\376\377\377\377", 4) = 4
[pid 79632] <... read resumed>"\376\377\377\377", 4) = 4
[pid 80590] rt_sigprocmask(SIG_BLOCK, ~[RTMIN RT_1], <unfinished ...>
[pid 79632] wait4(80590, <unfinished ...>
[pid 80590] <... rt_sigprocmask resumed>[], 8) = 0
[pid 80590] getpid() = 80590
[pid 80590] gettid() = 80590
[pid 80590] tgkill(80590, 80590, SIGKILL) = ?
[pid 80590] +++ killed by SIGKILL +++
[pid 79632] <... wait4 resumed>[{WIFSIGNALED(s) && WTERMSIG(s) == SIGKILL}], 0, NULL) = 80590
[pid 79632] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=80590, si_uid=1000, si_status=SIGKILL, si_utime=0, si_stime=1} ---
[pid 79632] wait4(80590, 0x7ffd878ab9b4, WNOHANG, NULL) = -1 ECHILD (No child processes)
[pid 79632] rt_sigreturn({mask=[]}) = 80590
[pid 79632] close(11) = 0
[pid 79632] rt_sigprocmask(SIG_BLOCK, [CHLD], NULL, 8) = 0
[pid 79632] wait4(0, 0x7ffd878754e4, WNOHANG, NULL) = 0
[pid 79632] kill(0, SIGKILLKilled
I'm running this for a normal R process installing cmdstan for comparison. I don't see any mention of wsl in the strace from the R process.narrow-lion-2703
12/20/2023, 6:46 AMnarrow-lion-2703
12/20/2023, 7:30 AMp <- processx::process$new("wsl", "uname") and it also has that tgkill stuff in strace. I think its just part of how internals of error handling in processx work. Im also not sure why does it even go down that wsl code path herenarrow-lion-2703
12/20/2023, 7:30 AMnarrow-lion-2703
12/20/2023, 7:34 AMstrace -o ss.log -fYy ... so it will pring process name not just pid, maybe that'll give us more cluesbrash-air-25337
12/21/2023, 12:28 AM-fy flags although the -Y doesn't work for the flavor of strace I have installed.
More output is here: https://gist.github.com/jburos/8df4f05e5502a37178e5a30b22f7c068
though, i'm not sure it includes enough of the output. I was noticing the child process with PID 51913 was killed, here: https://gist.github.com/jburos/8df4f05e5502a37178e5a30b22f7c068#file-gistfile1-txt-L22
I'm not familiar with reading strace logs, .. really appreciate your help to date on this I realize it's extra!
For next steps, I'm thinking to set up a simpler example of an R script that just spawns sub-processes to try to find the culprit.average-beach-28850
12/21/2023, 5:24 AMtgkillaverage-beach-28850
12/21/2023, 5:25 AMkill(0, SIGKILL) itselfaverage-beach-28850
12/21/2023, 5:26 AMaverage-beach-28850
12/21/2023, 5:27 AMremotes.install_github('stan-dev/cmdstanr', force = True) ?