made the error message more understandable - #29505
Conversation
|
Since we are already improving the error message, I wanted to get your thoughts on one additional idea. Would it make sense to also check whether The implementation I was considering is roughly as follows: func launchWinProxy(opts WinProxyOpts) (bool, string, error) {
machinePipe := env.WithPodmanPrefix(opts.Name)
if !PipeNameAvailable(machinePipe, MachineNameWait) {
pids := []string{}
// 1. Check for active win-sshproxy PID
if pid, _, _, err := readWinProxyTid(opts.Name, opts.VMType); err == nil {
if active, _ := GetProcessState(int(pid)); active {
pids = append(pids, fmt.Sprintf("win-sshproxy [PID %d]", pid))
}
}
// 2. Check for active gvproxy PID
if dirs, err := env.GetMachineDirs(opts.VMType); err == nil {
if gvproxyPidFile, err := dirs.RuntimeDir.AppendToNewVMFile("gvproxy.pid", nil); err == nil {
if gvPidData, err := gvproxyPidFile.Read(); err == nil {
if gvPid, err := strconv.Atoi(strings.TrimSpace(string(gvPidData))); err == nil {
if active, _ := GetProcessState(gvPid); active {
pids = append(pids, fmt.Sprintf("gvproxy [PID %d]", gvPid))
}
}
}
}
}
hint := " (an existing proxy process like win-sshproxy or gvproxy may still be running; try terminating it and retrying)"
if len(pids) > 0 {
hint = fmt.Sprintf(" (existing proxy process %s is still running; try terminating it and retrying)", strings.Join(pids, ", "))
}
return false, "", fmt.Errorf(
"could not start api proxy since expected pipe is not available: %s%s",
machinePipe, hint,
)
}
If you think this approach makes sense, I can add it in the next commit. |
|
In your commit message, the |
mheon
left a comment
There was a problem hiding this comment.
Error message changes LGTM
|
On adding the PID, I don't know if there's a need. @baude Opinion? |
|
i generally think more information is good in error messages. that said, have you looked at gvisor-tap-vsock to see what its resetful api offers and whether there is any wiggle room there? |
|
hi @baude i have check the endpoints and based on that we can use GET /services/forwarder/all endpoint `` , that will give us all the endpoints and since we already know what ips does the podman will gonna add(since they were common gateways ) , then if all the ips were of pod man then we know no other service or programme is ussing it and it became safer to delete - the solved @l0rd concern too , that only for the happy path , but if not then fallback to hint should be there , in case of win-sshproxy i dont know i can able to find any endpoints i think its a single binary only , so , but i dont think adding this much complexity worth it. |
| if !PipeNameAvailable(machinePipe, MachineNameWait) { | ||
| return false, "", fmt.Errorf("could not start api proxy since expected pipe is not available: %s (an existing proxy process like win-sshproxy or gvproxy may still be running from a previous machine session; try terminating it and retrying)", machinePipe) | ||
| } |
There was a problem hiding this comment.
I am not sure why you are calling PipeNameAvailable() again, but we are already checking if !PipeNameAvailable(machinePipe, MachineNameWait) a few lines earlier. You probably want to add the message there?
There was a problem hiding this comment.
sorry i will correct it , its my mistake
|
@nXtCyberNet The logic you are proposing makes sense, but if an old Another approach is to retrieve the PIDs of:
And if the two PIDs match, kill the process. If they don't, provide the details of the listening process (the name, for instance). |
Honny1
left a comment
There was a problem hiding this comment.
Please squash commits and and format commit msg. I think Fixes should be on a new line, or our CI will complain about the length of the commit message.
Should I update the code ? |
|
@nXtCyberNet I would keep this PR simple with the error message only, but please squash the commits and fix the commit message. |
|
Yeah, make the PID changes a followup PR |
Fixes podman-container-tools#29474 Signed-off-by: nXtCyberNet <rohantech2005@gmail.com>
8790594 to
dd3ba9c
Compare
Honny1
left a comment
There was a problem hiding this comment.
Fixes #29474 will prematurely close the issue. @l0rd, as commented, mentioning that we would like to keep that issue open. #29505 (comment)
| machinePipe := env.WithPodmanPrefix(mc.Name) | ||
| if !machine.PipeNameAvailable(machinePipe, machine.MachineNameWait) { | ||
| return nil, "", 0, fmt.Errorf("could not start api proxy since expected pipe is not available: %s", machinePipe) | ||
| return nil, "", 0, fmt.Errorf("could not start api proxy since expected pipe is not available: %s (an existing proxy process like win-sshproxy or gvproxy may still be running from a previous machine session; try terminating it and retrying)", machinePipe) |
There was a problem hiding this comment.
Nonblocking: Maybe share that error msg in one place.
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?