Page MenuHomePhabricator

Aphlict wont LISTEN to 22280 if notification.client-uri is switch to /ws (nginx)
Closed, DuplicatePublic

Description

Motivations

In order to adress :

Out of curiosity, what's your reasoning for passing this through nginx instead of configuring a direct connection?

The instance is hosted in a virtualisation cluster that have a large bunch of IPV6 but only one IPv4 gateway and some dev cant access IPv6 (bad networks providers ect).

So I read T7097: Following documentation on Aphlict+nginx results in empty client-port for Aphlict wich basically describes the same issue.
@joshuaspence tryed something in D11423: Don't pass `--admin-host` to the Aphlict server but the revision was abandonned.

SO i digged into the code.

What works well

  • let notification.client-uri to default value
  • start aphlict
  • output netstat -tulpn
tcp        0      0 localhost:22280         *:*                     LISTEN      7317/node       
tcp        0      0 localhost:22281         *:*                     LISTEN      7317/node

What doesn't works

  • set notification.client-uri to default http://localhost/ws as specified in docs
  • start aphlict
  • output netstat -tulpn
tcp        0      0 localhost:22281         *:*                     LISTEN     6685/node

As you can see client is not started

As far as I understand

My Fix proposal

https://secure.phabricator.com/diffusion/P/browse/master/support/aphlict/server/aphlict_server.js$21-31

Replace

for (var ii = 2; ii < argv.length; ii++) {
   var arg = argv[ii];
   var matches = arg.match(/^--([^=]+)=(.*)$/);
   if (!matches) {
     throw new Error('Unknown argument "' + arg + '"!');
   }
   if (!(matches[1] in config)) {
     throw new Error('Unknown argument "' + matches[1] + '"!');
   }
   config[matches[1]] = matches[2];
 }

with :

for (var ii = 2; ii < argv.length; ii++) {
   var arg = argv[ii];
   var matches = arg.match(/^--([^=]+)=(.*)$/);
   if (!matches) {
     throw new Error('Unknown argument "' + arg + '"!');
   }
   if (!(matches[1] in config)) {
     throw new Error('Unknown argument "' + matches[1] + '"!');
   }
   if (matches[2] !== '') {
     config[matches[1]] = matches[2];
   }
 }

If you guys think its OK let me do a diff !!
Macro successkid: contributor badge incomming

Event Timeline

tycho.tatitscheff renamed this task from Aphlict wont LISTEN to 22280 ifnotification.client-uri is switch to /ws (nginx) to Aphlict wont LISTEN to 22280 if notification.client-uri is switch to /ws (nginx).
tycho.tatitscheff raised the priority of this task from to Needs Triage.
tycho.tatitscheff updated the task description. (Show Details)

I added a diff that is way better than what is proposed in description.

eadler added a project: Restricted Project.Jan 9 2016, 1:04 AM
eadler moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.

Adding if (matches[2]) before content[matches[1]] = matches[2] in aphlict_server.js (to allow the default to kick in for otherwise empty values on the cli) resolves the problem for me.

I plan to make these options explicit instead. This tangled maze of inferring things from various values is a bad state of affairs. See T10697.