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

Service Broker can't start in Intel SGX Enclave with Gramine #1207

Open
4 tasks done
marchukv opened this issue May 8, 2023 · 1 comment
Open
4 tasks done

Service Broker can't start in Intel SGX Enclave with Gramine #1207

marchukv opened this issue May 8, 2023 · 1 comment

Comments

@marchukv
Copy link

marchukv commented May 8, 2023

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository

Current Behavior

Intel SGX technology offers a confidential computing service. The Gramine project utilizes this technology to run Linux applications.

During initialization, the Moleculer Service Broker creates a NodeCatalog that requires a list of IP addresses. To obtain this list, the broker uses the networkInterfaces() method from the node:os module. However, this method utilizes the netlink system call to retrieve the list of network interfaces, which is not supported by Gramine.

As a result, when the Service Broker is started, it throws an error message of "Unknown system error 97".

Correct me if I'm wrong but as far I understand from the code this list of ips is needed only for TCP transporter and isn't usable for anothers transport types. That's why there is the question - how to avoid geting list of ips during Service Broker starting in correct way?

Expected Behavior

Service Broker starts correctly with Gramine.

Failure Information

[2023-05-08T14:14:29.097Z] INFO  tee-trusted-loader-1683555269091/BROKER: Moleculer v0.14.24 is starting...
[2023-05-08T14:14:29.097Z] INFO  tee-trusted-loader-1683555269091/BROKER: Namespace: default
[2023-05-08T14:14:29.097Z] INFO  tee-trusted-loader-1683555269091/BROKER: Node ID: tee-trusted-loader-1683555269091
[2023-05-08T14:14:29.098Z] INFO  tee-trusted-loader-1683555269091/REGISTRY: Strategy: RoundRobinStrategy
[2023-05-08T14:14:29.099Z] INFO  tee-trusted-loader-1683555269091/REGISTRY: Discoverer: LocalDiscoverer
[2023-05-08T14:14:29.099Z] FATAL tee-trusted-loader-1683555269091/BROKER: Unable to create ServiceBroker. SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_interface_addresses returned Unknown system error 97 (Unknown system error 97)
    at __node_internal_captureLargerStackTrace (node:internal/errors:478:5)
    at new SystemError (node:internal/errors:238:5)
    at new NodeError (node:internal/errors:349:7)
    at __node_internal_checkError (node:os:68:13)
    at Object.networkInterfaces (node:os:267:16)
    at getIpList (/home/node/node_modules/moleculer/src/utils.js:172:25)
    at NodeCatalog.createLocalNode (/home/node/node_modules/moleculer/src/registry/node-catalog.js:47:17)
    at new NodeCatalog (/home/node/node_modules/moleculer/src/registry/node-catalog.js:35:8)
    at new Registry (/home/node/node_modules/moleculer/src/registry/registry.js:48:16)
    at new ServiceBroker (/home/node/node_modules/moleculer/src/service-broker.js:240:20)
    at MoleculerRunner.startBroker (/home/node/node_modules/moleculer/src/runner.js:507:17)
    at /home/node/node_modules/moleculer/src/runner.js:529:21 {
  code: 'ERR_SYSTEM_ERROR',
  info: { errno: 97, code: 'Unknown system error 97', message: 'Unknown system error 97', syscall: 'uv_interface_addresses' },
  errno: [Getter/Setter: 97],
  syscall: [Getter/Setter: 'uv_interface_addresses']

Steps to Reproduce

To reproduce this you need server with Intel SGX-compatible processor and correctly set up Gramine.
Then try to start Moleculer

Reproduce code snippet

const broker = new ServiceBroker({
    logger: console,
    transporter: {type:'AMQP', options: {url:'amqp://localhost:5672'}
});

broker.start();

Context

Everuthing is described in Current Behavior section.

Failure Logs

GoTo Failure Information section

@icebob
Copy link
Member

icebob commented May 16, 2023

The IP addresses are used by TCP transporter and it's visible in nodes command in REPL. I think the easier solution is if we wrap the getIpList method in utils into a try...catch block and if an error occurs we return with an empty array. Could you create a PR with this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants