Incoming Links can crash the dashboard #2

Closed
opened 8 months ago by dominic · 3 comments
dominic commented 8 months ago (Migrated from gits.oe7drt.net)

Situation: Hotspot is connected to a reflector and e.g. an Openspot connects to the hotspot (gateway).

That results in something like this in Links.log

2024-01-30 09:21:19: DPlus link - Type: Dongle Rptr: OE7DRT E Refl: REF096 A Dir: Outgoing
2024-01-30 09:45:19: DPlus link - Type: Dongle User: OE7DRT   Dir: Incoming

Connections in the log of DStarGateway look like this:

Jän 30 11:32:52 raspi2 dstargateway[477]: [2024-01-30 10:32:52] [INFO   ] D-Plus dongle link to OE7DRT   has started
Jän 30 11:39:39 raspi2 dstargateway[477]: [2024-01-30 10:39:39] [INFO   ] D-Plus link to OE7DRT   has failed (poll inactivity)

As soon as the Openspot connects the dashboard dies. (Line numbers may differ because I added some comments in the file)

Jän 30 11:00:58 raspi2 systemd[1]: Started D-STAR Gateway Dashboard.
Jän 30 11:01:00 raspi2 node[2224]: /home/dashboard/dsgwdashboard/index.js:89
Jän 30 11:01:00 raspi2 node[2224]:                         var linkrec = {'timestamp':mylinks[1].substr(0,19) , 'protocol':mylinks[2] , 'device':mylinks[4],
Jän 30 11:01:00 raspi2 node[2224]:                                                           ^
Jän 30 11:01:00 raspi2 node[2224]: TypeError: Cannot read properties of null (reading '1')
Jän 30 11:01:00 raspi2 node[2224]:     at updatelinks (/home/dashboard/dsgwdashboard/index.js:89:38)
Jän 30 11:01:00 raspi2 node[2224]:     at Object.<anonymous> (/home/dashboard/dsgwdashboard/index.js:31:1)
Jän 30 11:01:00 raspi2 node[2224]:     at Module._compile (node:internal/modules/cjs/loader:1378:14)
Jän 30 11:01:00 raspi2 node[2224]:     at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
Jän 30 11:01:00 raspi2 node[2224]:     at Module.load (node:internal/modules/cjs/loader:1212:32)
Jän 30 11:01:00 raspi2 node[2224]:     at Module._load (node:internal/modules/cjs/loader:1028:12)
Jän 30 11:01:00 raspi2 node[2224]:     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
Jän 30 11:01:00 raspi2 node[2224]:     at node:internal/main/run_main_module:28:49
Jän 30 11:01:00 raspi2 node[2224]: Node.js v21.6.1

This continues in a loop.

I managed to let the dashboard not die when I changed line 86 from the original index.js to also include the regexp matching in the if-clause.

function updatelinks() {
	const linksregex = /(.*) (.*) (.*) - Type: (.*) Rptr: (.*) Refl: (.*) Dir: (.*)/;
	const linkfile = fs.readFileSync(links).toString();
	const lines = linkfile.split(/\n|\r\n/);
	while (linklist.size() > 0) {
		linklist.deq();
	};
	let i = 0;
	while (i < lines.length) {
		if(lines[i] != "" && lines[i].match(linksregex)) {
			// console.log(JSON.stringify(lines[i]));
			var mylinks = lines[i].match(linksregex);
			var linkrec = {'timestamp':mylinks[1].substr(0,19) , 'protocol':mylinks[2] , 'device':mylinks[4],
				'repeater':mylinks[5] , 'reflector':mylinks[6] , 'direction' : mylinks[7] };
			linklist.push(linkrec);
		}
		i++;
	}
}

That works for now, though the incoming Link is not shown on the dashboard itself.

Situation: Hotspot is connected to a reflector and e.g. an Openspot connects to the hotspot (gateway). That results in something like this in Links.log ```plain 2024-01-30 09:21:19: DPlus link - Type: Dongle Rptr: OE7DRT E Refl: REF096 A Dir: Outgoing 2024-01-30 09:45:19: DPlus link - Type: Dongle User: OE7DRT Dir: Incoming ``` Connections in the log of DStarGateway look like this: ```plain Jän 30 11:32:52 raspi2 dstargateway[477]: [2024-01-30 10:32:52] [INFO ] D-Plus dongle link to OE7DRT has started Jän 30 11:39:39 raspi2 dstargateway[477]: [2024-01-30 10:39:39] [INFO ] D-Plus link to OE7DRT has failed (poll inactivity) ``` As soon as the Openspot connects the dashboard dies. (Line numbers may differ because I added some comments in the file) ```plain Jän 30 11:00:58 raspi2 systemd[1]: Started D-STAR Gateway Dashboard. Jän 30 11:01:00 raspi2 node[2224]: /home/dashboard/dsgwdashboard/index.js:89 Jän 30 11:01:00 raspi2 node[2224]: var linkrec = {'timestamp':mylinks[1].substr(0,19) , 'protocol':mylinks[2] , 'device':mylinks[4], Jän 30 11:01:00 raspi2 node[2224]: ^ Jän 30 11:01:00 raspi2 node[2224]: TypeError: Cannot read properties of null (reading '1') Jän 30 11:01:00 raspi2 node[2224]: at updatelinks (/home/dashboard/dsgwdashboard/index.js:89:38) Jän 30 11:01:00 raspi2 node[2224]: at Object.<anonymous> (/home/dashboard/dsgwdashboard/index.js:31:1) Jän 30 11:01:00 raspi2 node[2224]: at Module._compile (node:internal/modules/cjs/loader:1378:14) Jän 30 11:01:00 raspi2 node[2224]: at Module._extensions..js (node:internal/modules/cjs/loader:1437:10) Jän 30 11:01:00 raspi2 node[2224]: at Module.load (node:internal/modules/cjs/loader:1212:32) Jän 30 11:01:00 raspi2 node[2224]: at Module._load (node:internal/modules/cjs/loader:1028:12) Jän 30 11:01:00 raspi2 node[2224]: at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12) Jän 30 11:01:00 raspi2 node[2224]: at node:internal/main/run_main_module:28:49 Jän 30 11:01:00 raspi2 node[2224]: Node.js v21.6.1 ``` This continues in a loop. I managed to let the dashboard not die when I changed line 86 from the original index.js to also include the regexp matching in the if-clause. ```javascript function updatelinks() { const linksregex = /(.*) (.*) (.*) - Type: (.*) Rptr: (.*) Refl: (.*) Dir: (.*)/; const linkfile = fs.readFileSync(links).toString(); const lines = linkfile.split(/\n|\r\n/); while (linklist.size() > 0) { linklist.deq(); }; let i = 0; while (i < lines.length) { if(lines[i] != "" && lines[i].match(linksregex)) { // console.log(JSON.stringify(lines[i])); var mylinks = lines[i].match(linksregex); var linkrec = {'timestamp':mylinks[1].substr(0,19) , 'protocol':mylinks[2] , 'device':mylinks[4], 'repeater':mylinks[5] , 'reflector':mylinks[6] , 'direction' : mylinks[7] }; linklist.push(linkrec); } i++; } } ``` That works for now, though the incoming Link is not shown on the dashboard itself.
dominic commented 8 months ago (Migrated from gits.oe7drt.net)

I will look into this after next week, as I will be at Hamcation. It may be a parsing error.
I don't have an OpenSpot to test with, though I know the OpenSpot 4s are causing issues on DPLUS reflectors, most notably on REF035 -- Of course the manufacturer claims it is not their fault.

The reason it won't show on the Dashboard, is likely due to a parsing error.

I will look into this after next week, as I will be at Hamcation. It may be a parsing error. I don't have an OpenSpot to test with, though I know the OpenSpot 4s are causing issues on DPLUS reflectors, most notably on REF035 -- Of course the manufacturer claims it is not their fault. The reason it won't show on the Dashboard, is likely due to a parsing error.
dominic commented 8 months ago (Migrated from gits.oe7drt.net)

Was closed by accident.

Was closed by accident.
dominic commented 8 months ago (Migrated from gits.oe7drt.net)

Yes no problem, just wanted to let you know about this. I'm using Openspot2 if that matters, but this will also be the problem when a Pi-Star or similar will connect as its proabably the incoming link that causes confusion when parsing the Links.log file (because the regex matching sting will not match on this line-they differ)

This is basically what I was doing, just linking another dstar gateway to another.
https://www.youtube.com/watch?v=CkY9PrroE58&t=764s

Yes no problem, just wanted to let you know about this. I'm using Openspot2 if that matters, but this will also be the problem when a Pi-Star or similar will connect as its proabably the incoming link that causes confusion when parsing the Links.log file (because the regex matching sting will not match on this line-they differ) This is basically what I was doing, just linking another dstar gateway to another. https://www.youtube.com/watch?v=CkY9PrroE58&t=764s
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: dominic/dsgwdashboard#2
Loading…
There is no content yet.