NICE DCV SDK Extension: Linux Virtual Channel - Unable to open socket

0

System

Ubuntu 22.04 x 2 (server and client)

Description

I have attempted to create a linux version of this CPP virtual channel example, using read, write, etc from <unistd.h>.

I have the extension installed on both server/client and it is being loaded by dcvserver and dcvviewer .

I appear to be getting stuck when trying to open the socket whose path is returned in the SetupVirtualChannelResponse.

Code

The main in my extension looks like this, up until the point of failure:

int main() 
{
  sprintf(log_file, "%s_%i.log", LOG_FILE, getpid());
  log_init(log_file);

  log_f("RequestVirtualChannel");

  RequestVirtualChannel();

  dcv::extensions::DcvMessage *msg = ReadNextMessage();
  if (msg == nullptr) 
  {
      log_f("Could not get messages from stdin");
      return -1;
  }

  log_f("Expecting a response");
  
  if (!msg->has_response()) 
  {
      log_f("Unexpected message case %u", msg->msg_case());
      delete msg;
      return -1;
  }

  if (msg->response().status() != dcv::extensions::Response_Status::Response_Status_SUCCESS) 
  {
      log_f("Error in response for setup request %u", msg->response().status());
      delete msg;
      return -1;
  }

  log_f("Connect to channel socket");
  
  const auto path = msg->response().setup_virtual_channel_response().relay_path();
  log_f("Received path %s", path.c_str());

  int sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
  if (sockfd == -1)
  {
    perror("socket");
    return 1;
  }
  
  struct sockaddr_un address;
  address.sun_family = AF_UNIX;
  strcpy(address.sun_path, path.c_str());

  if (connect(sockfd, (struct sockaddr*)&address, sizeof(address)) == -1) 
  {
      perror("connect");
      close(sockfd);
      log_f("Failed to open socket: %s", strerror(errno));
      delete msg;
      return -1;
  }
...

Setup

My setup seems sound, as I am able to establish a session and can see the extension being loaded on both sides. I also made sure to create the parent directory appropriate to the socket path being returned by msg->response().setup_virtual_channel_response().relay_path().

Output

DCVViewer

54:39,897570 [1416837:1416837] INFO  extensions-manager - Failed to open extensions directory (/usr/share/dcvextensions/): Error opening directory “/usr/share/dcvextensions/”: No such file or directory
54:39,897783 [1416837:1416837] INFO  extensions-manager - Loaded manifest file '/home/myuser/.local/share/dcvextensions/echo.json'
...
...
56:16,425099 [1416837:1416837] WARN  connection - License error (mode: Ec2): 2/2 products unlicensed
connect: No such file or directory
56:20,042845 [1416837:1416837] WARN  extensions-extension - cid=1 extid=0 - Failed to read from extension pipe connection: Pipe closed
56:20,042952 [1416837:1416837] INFO  extensions-extension - cid=1 extid=0 - Stopping extension
56:20,043016 [1416837:1416837] INFO  extensions-virtual-channels-manager - Received request to close virtual channel 'com.company.test::echo'
56:20,043055 [1416837:1416837] INFO  extensions-virtual-channel - cid=1 vc='com.company.test::echo' - Closed
56:20,043094 [1416837:1416837] INFO  extensions-virtual-channels-manager - Failed to unregister custom channel 'com.company.test::echo': Custom channel echo is not registered
56:20,043122 [1416837:1416837] INFO  extensions-virtual-channels-manager - Virtual channel 'com.company.test::echo' closed
...

Extension log file (client side)

Created
RequestVirtualChannel
Expecting a response
Connect to channel socket
Received path /com/nicesoftware/dcv/dcvextensions_CF60872C
Failed to open socket: No such file or directory

DCVServer

...
54:40,011815 [  3330:3330  ] INFO  extensions-proxy - Received request to open virtual channel 'com.company.test::echo' for connection '1'
54:40,012194 [  3330:3330  ] INFO  session - Register custom channel 'com.company.test::echo' for session 1 with required permissions: extensions-server
54:40,012226 [  3330:3330  ] INFO  extensions-proxy - Request to open virtual channel 'com.company.test::echo' for connection '1' completed
54:40,037686 [  3330:3330  ] INFO  connection - Channel 'com.company.test::echo' not available for user 'ubuntu', extension virtual channel not available yet.
...
56:20,014262 [  3330:3330  ] INFO  extensions-proxy - Received request to close virtual channel 'com.company.test::echo' of connection '1'
56:20,014308 [  3330:3330  ] INFO  extensions-virtual-channel - cid=1 vc='com.company.test::echo' - Closed
56:20,014324 [  3330:3330  ] INFO  session - Unregister custom channel 'com.company.test::echo' for session 1
...

Observations

  1. In the DCVServer log, I see extension virtual channel not available yet - is there a timing issue because of my implementation?
  2. On the client-side, I have attempted to check the file system to see if a socket is created at the location provided as the relay_path() value (e.g. /com/nicesoftware/dcv/dcvextensions_CF60872C), but I never see anything there.

Any assistance or advice would be greatly appreciated.

Thank you!

P.S: This was also posted on the dcv-extension-sdk-samples github

logicp
asked 5 months ago459 views
2 Answers
0

bumping for attention

logicp
answered 5 months ago
0

Update:

I got past the issue and was able to read/write one message from client to server using my linux implementation here: https://github.com/StronglogicSolutions/dcv-channel

HOWEVER, the socket always closes prematurely and dcv shuts down my extension.

Furthermore, I see NO evidence that DCV Extensions work for Linux. I've not seen one example of anyone ever having made an extension, and none of the AWS samples show an implementation of a DCV extension for Linux (they're all for Windows).

According to their documentation, Linux is supported.

To try and get unstuck, I paid for a developer support account on AWS and submitted a ticket, but than them pointing out that they had a mistake in their linux documentation (which helped me get unstuck at one point), a subsequent ticket was open with them for many weeks and I ultimately ended my developer account because it didn't seem to be useful (and was costing me money).

Does anyone have evidence that DCV Extensions work on Linux? I would love some insight.

logicp
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions