Skip to content
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

Contexts aren't added/deleted from the Tray menu on Linux platforms #3765

Closed
torchiaf opened this issue Jan 12, 2023 · 3 comments · Fixed by #3963
Closed

Contexts aren't added/deleted from the Tray menu on Linux platforms #3765

torchiaf opened this issue Jan 12, 2023 · 3 comments · Fixed by #3963
Assignees
Labels
kind/bug Something isn't working
Projects
Milestone

Comments

@torchiaf
Copy link
Contributor

torchiaf commented Jan 12, 2023

Actual Behavior

Contexts aren't added/deleted from the Tray menu until restarting Rancher Desktop.

Steps to Reproduce

Reproduction steps make use of k3d

  1. Start Rancher Desktop and wait for Kubernetes is running state in tray
  2. Create a new cluster in k3d (k3d cluster create test-cluster)
  3. Open the tray menu and hover over Kubernetes Contexts
  4. Observe that test cluster is missing from the list of Kubernetes Contexts
  5. Restart Rancher Desktop and wait for Kubernetes is running state
  6. Observe that test cluster is present in the list of Kubernetes Contexts

Result

Contexts aren't added/deleted from the Tray menu until restarting Rancher Desktop.

Expected Behavior

Contexts are added/deleted from the Tray menu immediately.

Additional Information

There is an uncaught exception from fs.watch

const options: fs.WatchOptions = {
persistent: false,
recursive: true,
encoding: 'utf-8',
signal: abortController.signal,
};

Exception message:

(node:12162) UnhandledPromiseRejectionWarning: TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
    at new NodeError (node:internal/errors:372:5)
    at Object.watch (node:fs:2262:11)
    at /home/francesco/WORK/rancher/rancher-desktop/dist/app/background.js:54887:73
    at Array.map (<anonymous>)
    at Tray.watchForChanges (/home/francesco/WORK/rancher/rancher-desktop/dist/app/background.js:54887:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
(node:12162) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) 

The recursive option is not available on Linux when watching directories (Node verion >= 14) but it seems that will be introduced in next Node.js versions (18.x)
nodejs/node#45098

Rancher Desktop Version

1.7.x

Rancher Desktop K8s Version

any

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

Other Linux

Operating System / Build Version

Linux

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

@torchiaf torchiaf added the kind/bug Something isn't working label Jan 12, 2023
@torchiaf torchiaf added this to To do in Stripey via automation Jan 12, 2023
@torchiaf torchiaf added this to the Next milestone Jan 12, 2023
@gaktive gaktive modified the milestones: Next, Later Feb 13, 2023
@rak-phillip rak-phillip moved this from To do to In progress in Stripey Feb 15, 2023
@rak-phillip rak-phillip self-assigned this Feb 15, 2023
@rak-phillip
Copy link
Contributor

First attempt, updating to node 18 introduces a new issue:

node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/home/phillip/Development/rancher-desktop/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/home/phillip/Development/rancher-desktop/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/home/phillip/Development/rancher-desktop/node_modules/webpack/lib/NormalModule.js:471:10)
    at /home/phillip/Development/rancher-desktop/node_modules/webpack/lib/NormalModule.js:503:5
    at /home/phillip/Development/rancher-desktop/node_modules/webpack/lib/NormalModule.js:358:12
    at /home/phillip/Development/rancher-desktop/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/phillip/Development/rancher-desktop/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/home/phillip/Development/rancher-desktop/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/home/phillip/Development/rancher-desktop/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /home/phillip/Development/rancher-desktop/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /home/phillip/Development/rancher-desktop/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

The root cause appears to be linked to webpack/webpack#14532, which explains that node has updated OpenSSL in versions > 16.x; the updated OpenSSL version doesn't support legacy hashing algorithms. There appears to be several potential workarounds, each of which that has their own downsides

  1. Update the hash function in webpack: output.hashFunction: "xxhash64 | sha512 | sha256".

    This doesn't have any effect on the behavior at all. It seems to me that this error is happening before webpack begins bundling.

  2. Add --openssl-legacy-provider to dev/build scripts.

    Performing this action raises another error: electron: --openssl-legacy-provider is not allowed in NODE_OPTIONS

Upgrading to node 18 appears to come with some technical debt associated with it. EOL for node 16 has been extended to September 11th, 2023 because of the breaking changes associated with the update to OpenSSL 3.

@rak-phillip
Copy link
Contributor

rak-phillip commented Feb 15, 2023

Testing changes made in #3958 and the behavior still appears to be regressed. I'm finding that navigating to "General" appears to trigger the refresh of the Kubernetes Context list. Still need to compare this behavior with main. It will also be a good idea to repro on other platforms with and without the patch that moves us to node 18.

Edit: Tested against main in Linux and reproduced the same behavior as above where navigating to "General" appears to refresh the list.

@rak-phillip
Copy link
Contributor

The behavior described above is a side-effect of handleUpdateNetworkStatus in pkg/rancher-desktop/main/tray.ts. We can't utilize this to resolve the issue because we're just rebuilding the tray menu every time that the General page is loaded. While this appears to work, it is not a tenable solution.

@jandubois jandubois moved this from In progress to Done in Stripey Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
No open projects
3 participants