Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Cannot read property '0' of undefined #12

Open
mrhieu1311 opened this issue Sep 5, 2018 · 26 comments
Open

Cannot read property '0' of undefined #12

mrhieu1311 opened this issue Sep 5, 2018 · 26 comments
Assignees
Labels
bug Something isn't working

Comments

@mrhieu1311
Copy link

I have encountered the problem when npm start

root@isc-kea-primary:~/src/kea-anterius#npm start

[email protected] start /home/tgdd/src/kea-anterius
node ./bin/www

Anterius Server> Bootup complete
Anterius Server> OUI Database Loaded
Error 1: TypeError: Cannot read property '0' of undefined
at /home/tgdd/src/kea-anterius/app.js:249:135
at
at process._tickCallback (internal/process/next_tick.js:188:7)


This is state of isc kea server

root@isc-kea-primary:~/src/kea-anterius# keactrl status
DHCPv4 server: active
DHCPv6 server: inactive
DHCP DDNS: inactive
Control Agent: active
Kea DHCPv4 configuration file: /usr/local/etc/kea/kea-dhcp4.conf
Kea DHCPv6 configuration file: /usr/local/etc/kea/kea-dhcp6.conf
Kea DHCP DDNS configuration file: /usr/local/etc/kea/kea-dhcp-ddns.conf
Kea Control Agent configuration file: /usr/local/etc/kea/kea-ctrl-agent.conf
keactrl configuration file: /usr/local/etc/kea/keactrl.conf

root@isc-kea-primary:~/src/kea-anterius# netstat -utnpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1076/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1014/sshd
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 8924/kea-ctrl-agent
tcp6 0 0 :::22 :::* LISTEN 1014/sshd
udp 0 0 10.1.32.101:67 0.0.0.0:* 6417/kea-dhcp4

@Anthrino
Copy link
Contributor

Anthrino commented Sep 6, 2018

Thank you for raising this concern @mrhieu1311.

This error is likely to be caused by a delay in response from the Kea CA API. I wasn't able to reproduce this exact situation in my setup, nevertheless, will add a fix in the API function to process such errors.

@Anthrino Anthrino self-assigned this Sep 6, 2018
@Anthrino Anthrino added the bug Something isn't working label Sep 6, 2018
@raybellis
Copy link
Collaborator

raybellis commented Sep 6, 2018

Jerin, a possible cause is this in api_service.js:

            res.on('data', function (body) {
                // console.log('BODY: ' + body);
                response_data = JSON.parse(body)[0];
            });

It's perfectly possible that the body may be split across multiple .on('data') events, so the normal paradigm here is to simply accumulate the body content into a variable in the enclosing scope, and then perform the parsing in the .on('end') callback.

@raybellis
Copy link
Collaborator

BTW, in related code at the point of the original reported error, this .then() callback is a "no-op":

.then(function (sapi_data) {
      return sapi_data;
});

@mrhieu1311
Copy link
Author

BTW, in related code at the point of the original reported error, this .then() callback is a "no-op":

.then(function (sapi_data) {
      return sapi_data;
});

Hi raybellis
How can i resolve this issue

@raybellis
Copy link
Collaborator

For the sapi_data function just omit the whole .then block completely.

@raybellis
Copy link
Collaborator

raybellis commented Oct 13, 2018

For the body it's something like:

var body = '';
res.on('data', function (data) {
            body += data;
});

res.on('end', function(data) {
    body += data;
    response_data = JSON.parse(body)[0];
    ....
});

@mrhieu1311
Copy link
Author

For the body it's something like:

var body = '';
res.on('data', function (data) {
            body += data;
});

res.on('end', function(data) {
    body += data;
    response_data = JSON.parse(body)[0];
    ....
});

I comment all the line below in /lib/api_service.js and can " npm start" successfull
// var response_data;
// res.on('data', function (body) {
// console.log('BODY: ' + body);
// response_data = JSON.parse(body)[0];
// });

but when i access to web gui : localhost:3000
it exports new issue: Cannot read property 'shared-networks' of undefined

@raybellis
Copy link
Collaborator

diff --git a/lib/api_service.js b/lib/api_service.js
index 2f0bde8..46002e8 100644
--- a/lib/api_service.js
+++ b/lib/api_service.js
@@ -28,13 +28,13 @@ module.exports = {
                 }
                 res.setEncoding('utf8');
 
-                var response_data;
-                res.on('data', function (body) {
-                    // console.log('BODY: ' + body);
-                    response_data = JSON.parse(body)[0];
+                let body = '';
+                res.on('data', function (chunk) {
+                    body += chunk;
                 });
                 res.on('end', function () {
                     try {
+                        let response_data = JSON.parse(body)[0];
                         resolve(response_data);
                     } catch (error) {
                         reject(error);
@@ -49,4 +49,4 @@ module.exports = {
             req.end();
         });
     }

@tomaszmrugalski
Copy link
Member

Hey @raybellis, just gave you write permission. This project is running on a skeleton crew, so not sure whether we can count on any review procedures. There aren't any defined anyway.

Feel free to commit your fix directly.

And thanks a lot for the patch!

@raybellis
Copy link
Collaborator

raybellis commented Oct 16, 2018

I put the patch here rather than committing direct because it's not fully tested. With it in place I can access the Anterius server, but I don't have a Kea server running for it to talk to so I get no useful content out of it.

I guess I could fork and send a PR for someone else to test, though :)

@raybellis
Copy link
Collaborator

#18

@mrhieu1311
Copy link
Author

mrhieu1311 commented Oct 17, 2018

diff --git a/lib/api_service.js b/lib/api_service.js
index 2f0bde8..46002e8 100644
--- a/lib/api_service.js
+++ b/lib/api_service.js
@@ -28,13 +28,13 @@ module.exports = {
                 }
                 res.setEncoding('utf8');
 
-                var response_data;
-                res.on('data', function (body) {
-                    // console.log('BODY: ' + body);
-                    response_data = JSON.parse(body)[0];
+                let body = '';
+                res.on('data', function (chunk) {
+                    body += chunk;
                 });
                 res.on('end', function () {
                     try {
+                        let response_data = JSON.parse(body)[0];
                         resolve(response_data);
                     } catch (error) {
                         reject(error);
@@ -49,4 +49,4 @@ module.exports = {
             req.end();
         });
     }

I'm not a programmer. follow your code. but still got error
Error 1: TypeError: Cannot read property '0' of undefined
at /home/tgdd/src/kea-anterius/app.js:249:135
1234
12345

@raybellis
Copy link
Collaborator

Try adding console.log(body) as the first line of the try block so we can see exactly what it is that the server returned.

@mrhieu1311
Copy link
Author

[ { "arguments": { "Dhcp4": { "control-socket": { "socket-name": "/tmp/kea-dhcp4-ctrl.sock", "socket-type": "unix" }, "decline-probation-period": 86400, "dhcp-ddns": { "always-include-fqdn": false, "enable-updates": false, "generated-prefix": "myhost", "max-queue-size": 1024, "ncr-format": "JSON", "ncr-protocol": "UDP", "override-client-update": false, "override-no-update": false, "qualifying-suffix": "", "replace-client-name": "never", "sender-ip": "0.0.0.0", "sender-port": 0, "server-ip": "127.0.0.1", "server-port": 53001 }, "dhcp4o6-port": 0, "echo-client-id": true, "expired-leases-processing": { "flush-reclaimed-timer-wait-time": 25, "hold-reclaimed-time": 3600, "max-reclaim-leases": 100, "max-reclaim-time": 250, "reclaim-timer-wait-time": 10, "unwarned-reclaim-cycles": 5 }, "hooks-libraries": [ { "library": "/usr/local/lib/hooks/libdhcp_lease_cmds.so", "parameters": { } }, { "library": "/usr/local/lib/hooks/libdhcp_ha.so", "parameters": { "high-availability": [ { "heartbeat-delay": 10000, "max-ack-delay": 5000, "max-response-delay": 10000, "max-unacked-clients": 0, "mode": "load-balancing", "peers": [ { "auto-failover": true, "name": "server101", "role": "primary", "url": "http://10.1.32.101:8000/" }, { "auto-failover": true, "name": "server102", "role": "secondary", "url": "http://10.1.32.102:8000/" } ], "send-lease-updates": true, "sync-leases": true, "sync-timeout": 60000, "this-server-name": "server101" } ] } } ], "host-reservation-identifiers": [ "hw-address", "duid", "circuit-id", "client-id" ], "hosts-databases": [ { "host": "127.0.0.1", "name": "isckeadhcp", "password": "ISCkea@123", "port": 3306, "type": "mysql", "user": "isckea" } ], "interfaces-config": { "dhcp-socket-type": "udp", "interfaces": [ "eth0" ], "re-detect": true }, "lease-database": { "lfc-interval": 3600, "type": "memfile" }, "option-data": [ { "always-send": true, "code": 6, "csv-format": true, "data": "10.0.122.2, 103.48.78.156, 8.8.8.8, 103.48.78.157, 8.8.4.4", "name": "domain-name-servers", "space": "dhcp4" } ], "option-def": [ ], "rebind-timer": 1800, "renew-timer": 900, "shared-networks": [ { "match-client-id": true, "name": "test", "option-data": [ ], "relay": { "ip-addresses": [ ] }, "reservation-mode": "all", "subnet4": [ ] } ], "subnet4": [ { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 1225, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.5.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.g.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.5.10-10.122.5.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.5.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.5.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 1226, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.6.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.g.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.6.10-10.122.6.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.6.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.6.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 1227, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.7.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.g.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.7.10-10.122.7.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.7.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "00:14:38:9e:83:84", "ip-address": "10.122.7.254", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:3a:40", "ip-address": "10.122.7.253", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:43:00", "ip-address": "10.122.7.252", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:57:00", "ip-address": "10.122.7.251", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" } ], "server-hostname": "", "subnet": "10.122.7.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12210, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.10.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t1.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.10.10-10.122.10.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.10.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.10.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12211, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.11.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t1.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.11.10-10.122.11.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.11.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.11.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12212, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.12.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t1.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.12.10-10.122.12.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.12.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.12.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12213, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.13.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t1.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.13.10-10.122.13.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.13.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "00:14:38:9e:0a:69", "ip-address": "10.122.13.253", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "00:14:38:9f:35:25", "ip-address": "10.122.13.254", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:3b:40", "ip-address": "10.122.13.252", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:46:80", "ip-address": "10.122.13.250", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:58:00", "ip-address": "10.122.13.251", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" } ], "server-hostname": "", "subnet": "10.122.13.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12220, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.20.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.20.10-10.122.20.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.20.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.20.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12221, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.21.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.21.10-10.122.21.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.21.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.21.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12222, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.22.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.22.10-10.122.22.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.22.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.22.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12223, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.23.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.23.10-10.122.23.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.23.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "00:17:08:86:f1:63", "ip-address": "10.122.23.254", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:4d:40", "ip-address": "10.122.23.251", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" }, { "boot-file-name": "", "client-classes": [ ], "hostname": "", "hw-address": "88:5b:dd:b6:54:00", "ip-address": "10.122.23.252", "next-server": "0.0.0.0", "option-data": [ ], "server-hostname": "" } ], "server-hostname": "", "subnet": "10.122.23.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12224, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.24.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2-anm.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.24.150-10.122.24.240" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.24.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.24.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12225, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.25.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t2-anm.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.25.10-10.122.25.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.25.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.25.0/24", "valid-lifetime": 3600 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12230, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.30.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t3.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.30.10-10.122.30.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.30.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.30.0/24", "valid-lifetime": 14400 }, { "4o6-interface": "", "4o6-interface-id": "", "4o6-subnet": "", "boot-file-name": "", "id": 12233, "match-client-id": true, "next-server": "0.0.0.0", "option-data": [ { "always-send": false, "code": 3, "csv-format": true, "data": "10.122.33.1", "name": "routers", "space": "dhcp4" }, { "always-send": false, "code": 15, "csv-format": true, "data": "kea-dhcp.t3.tgdd.vn", "name": "domain-name", "space": "dhcp4" } ], "pools": [ { "option-data": [ ], "pool": "10.122.33.10-10.122.33.248" } ], "rebind-timer": 1800, "relay": { "ip-addresses": [ "10.122.33.1" ] }, "renew-timer": 900, "reservation-mode": "all", "reservations": [ ], "server-hostname": "", "subnet": "10.122.33.0/24", "valid-lifetime": 3600 } ], "valid-lifetime": 3600 }, "Logging": { "loggers": [ { "debuglevel": 0, "name": "kea-dhcp4", "output_options": [ { "flush": true, "maxsize": 1048576, "maxver": 5, "output": "/usr/local/var/log/kea-dhcp4.log" } ], "severity": "WARN" }, { "debuglevel": 0, "name": "kea-dhcp4.ha_hooks", "output_options": [ { "flush": true, "maxsize": 10240000, "maxver": 1, "output": "/usr/local/var/log/kea-dhcp4.ha_hooks.log" } ], "severity": "WARN" }, { "debuglevel": 99, "name": "kea-dhcp4.bad-packets", "output_options": [ { "flush": true, "maxsize": 10240000, "maxver": 1, "output": "/usr/local/var/log/kea-dhcp4.debug.log" } ], "severity": "DEBUG" } ] } }, "result": 0 } ]
[ { "arguments": { "declined-addresses": [ [ 1, "2018-10-17 08:35:56.953223" ] ], "pkt4-ack-sent": [ [ 41539, "2018-10-17 16:10:25.001334" ] ], "pkt4-decline-received": [ [ 2, "2018-10-17 08:35:56.953150" ] ], "pkt4-discover-received": [ [ 3200, "2018-10-17 16:09:23.198864" ] ], "pkt4-inform-received": [ [ 3673, "2018-10-17 16:10:04.497748" ] ], "pkt4-nak-sent": [ [ 265, "2018-10-17 16:02:50.840679" ] ], "pkt4-offer-sent": [ [ 3200, "2018-10-17 16:09:23.200186" ] ], "pkt4-receive-drop": [ [ 3, "2018-10-14 04:39:18.389321" ] ], "pkt4-received": [ [ 60521, "2018-10-17 16:10:24.997426" ] ], "pkt4-release-received": [ [ 11, "2018-10-17 14:19:36.144162" ] ], "pkt4-request-received": [ [ 39611, "2018-10-17 16:10:24.997500" ] ], "pkt4-sent": [ [ 45004, "2018-10-17 16:10:25.001322" ] ], "reclaimed-declined-addresses": [ [ 2, "2018-10-15 08:59:58.856112" ] ], "reclaimed-leases": [ [ 2582, "2018-10-17 16:04:05.115341" ] ], "subnet[12210].assigned-addresses": [ [ -7, "2018-10-17 15:54:34.361059" ] ], "subnet[12210].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379342" ] ], "subnet[12210].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379345" ] ], "subnet[12210].reclaimed-leases": [ [ 65, "2018-10-17 12:16:50.207861" ] ], "subnet[12210].total-addresses": [ [ 239, "2018-10-14 21:49:02.379223" ] ], "subnet[12211].assigned-addresses": [ [ -9, "2018-10-17 16:01:01.964405" ] ], "subnet[12211].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379355" ] ], "subnet[12211].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379358" ] ], "subnet[12211].reclaimed-leases": [ [ 71, "2018-10-17 15:32:49.887272" ] ], "subnet[12211].total-addresses": [ [ 239, "2018-10-14 21:49:02.379227" ] ], "subnet[12212].assigned-addresses": [ [ -7, "2018-10-17 15:49:02.745495" ] ], "subnet[12212].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379368" ] ], "subnet[12212].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379371" ] ], "subnet[12212].reclaimed-leases": [ [ 53, "2018-10-17 02:03:38.130685" ] ], "subnet[12212].total-addresses": [ [ 239, "2018-10-14 21:49:02.379230" ] ], "subnet[12213].assigned-addresses": [ [ -194, "2018-10-17 16:05:08.227777" ] ], "subnet[12213].declined-addresses": [ [ 0, "2018-10-15 08:59:58.856100" ] ], "subnet[12213].reclaimed-declined-addresses": [ [ 1, "2018-10-15 08:59:58.856115" ] ], "subnet[12213].reclaimed-leases": [ [ 501, "2018-10-17 16:02:00.538604" ] ], "subnet[12213].total-addresses": [ [ 239, "2018-10-14 21:49:02.379234" ] ], "subnet[12220].assigned-addresses": [ [ -14, "2018-10-17 11:26:54.985940" ] ], "subnet[12220].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379402" ] ], "subnet[12220].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379408" ] ], "subnet[12220].reclaimed-leases": [ [ 94, "2018-10-17 01:37:46.456523" ] ], "subnet[12220].total-addresses": [ [ 239, "2018-10-14 21:49:02.379238" ] ], "subnet[12221].assigned-addresses": [ [ -8, "2018-10-17 12:56:58.858129" ] ], "subnet[12221].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379427" ] ], "subnet[12221].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379431" ] ], "subnet[12221].reclaimed-leases": [ [ 94, "2018-10-17 12:11:18.630009" ] ], "subnet[12221].total-addresses": [ [ 239, "2018-10-14 21:49:02.379242" ] ], "subnet[12222].assigned-addresses": [ [ -28, "2018-10-17 11:48:21.417547" ] ], "subnet[12222].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379441" ] ], "subnet[12222].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379444" ] ], "subnet[12222].reclaimed-leases": [ [ 89, "2018-10-17 11:48:21.417561" ] ], "subnet[12222].total-addresses": [ [ 239, "2018-10-14 21:49:02.379245" ] ], "subnet[12223].assigned-addresses": [ [ -169, "2018-10-17 16:04:05.115338" ] ], "subnet[12223].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379453" ] ], "subnet[12223].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379457" ] ], "subnet[12223].reclaimed-leases": [ [ 442, "2018-10-17 16:04:05.115344" ] ], "subnet[12223].total-addresses": [ [ 239, "2018-10-14 21:49:02.379249" ] ], "subnet[12224].assigned-addresses": [ [ -15, "2018-10-17 15:57:48.058858" ] ], "subnet[12224].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379466" ] ], "subnet[12224].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379469" ] ], "subnet[12224].reclaimed-leases": [ [ 49, "2018-10-17 15:57:48.058866" ] ], "subnet[12224].total-addresses": [ [ 91, "2018-10-14 21:49:02.379253" ] ], "subnet[12225].assigned-addresses": [ [ -1, "2018-10-17 09:48:32.700995" ] ], "subnet[12225].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379478" ] ], "subnet[12225].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379482" ] ], "subnet[12225].reclaimed-leases": [ [ 5, "2018-10-17 09:48:32.701010" ] ], "subnet[12225].total-addresses": [ [ 239, "2018-10-14 21:49:02.379257" ] ], "subnet[12230].assigned-addresses": [ [ -16, "2018-10-17 15:54:31.553750" ] ], "subnet[12230].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379491" ] ], "subnet[12230].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379495" ] ], "subnet[12230].reclaimed-leases": [ [ 56, "2018-10-17 15:36:52.346825" ] ], "subnet[12230].total-addresses": [ [ 239, "2018-10-14 21:49:02.379261" ] ], "subnet[12233].assigned-addresses": [ [ -28, "2018-10-17 16:07:25.880916" ] ], "subnet[12233].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379504" ] ], "subnet[12233].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379507" ] ], "subnet[12233].reclaimed-leases": [ [ 96, "2018-10-17 15:30:01.536435" ] ], "subnet[12233].total-addresses": [ [ 239, "2018-10-14 21:49:02.379264" ] ], "subnet[1225].assigned-addresses": [ [ -18, "2018-10-17 08:01:11.035872" ] ], "subnet[1225].declined-addresses": [ [ 0, "2018-10-15 04:39:14.310702" ] ], "subnet[1225].reclaimed-declined-addresses": [ [ 1, "2018-10-15 04:39:14.310716" ] ], "subnet[1225].reclaimed-leases": [ [ 64, "2018-10-17 02:02:27.578416" ] ], "subnet[1225].total-addresses": [ [ 239, "2018-10-14 21:49:02.379205" ] ], "subnet[1226].assigned-addresses": [ [ -22, "2018-10-17 07:52:30.170138" ] ], "subnet[1226].declined-addresses": [ [ 0, "2018-10-14 21:49:02.379315" ] ], "subnet[1226].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379319" ] ], "subnet[1226].reclaimed-leases": [ [ 98, "2018-10-17 01:57:46.289007" ] ], "subnet[1226].total-addresses": [ [ 239, "2018-10-14 21:49:02.379214" ] ], "subnet[1227].assigned-addresses": [ [ -331, "2018-10-17 16:09:23.216404" ] ], "subnet[1227].declined-addresses": [ [ 1, "2018-10-17 08:35:56.953218" ] ], "subnet[1227].reclaimed-declined-addresses": [ [ 0, "2018-10-14 21:49:02.379332" ] ], "subnet[1227].reclaimed-leases": [ [ 805, "2018-10-17 16:00:47.875910" ] ], "subnet[1227].total-addresses": [ [ 239, "2018-10-14 21:49:02.379219" ] ] }, "result": 0 } ]
Error 1: TypeError: Cannot read property '0' of undefined
at /home/tgdd/src/kea-anterius/app.js:249:135
at
at process._tickCallback (internal/process/next_tick.js:188:7)

@raybellis
Copy link
Collaborator

raybellis commented Oct 17, 2018

There's two separate JSON blobs appearing there - please add an extra line e.g. console.log("body dump") before the current console.log() line so we can see where each one starts.

Curiously, I can actually read both those blobs separately, so I wonder if there's a third "empty" blob that's not appearing in the console output that's actually causing the error.

@informatik-bks
Copy link

I have the same issue

@TaggerTie
Copy link

TaggerTie commented Nov 28, 2018

Sadly i have to report that i have the same issue.

The KEA Backend is runnig fine, but when i start the NPM i've got the same error. I've added also the latest code changes but the error is still remaining.

I am using KEA 1.4.0-p1 (DHCP4 only) with local lease memfile and several subnets.

Error 1: TypeError: Cannot read property '0' of undefined
at /home/it/kea-anterius/app.js:258:135
at
at process._tickCallback (internal/process/next_tick.js:188:7)

@TaggerTie
Copy link

Does nobody have an idea?

@TaggerTie
Copy link

When i activate the outcommented line:

console.log(server,global.kea_server.server_config[global.kea_server.svr_tag], global.kea_server.sn_tag, global.kea_server.addr_tag);
i've got the error message:

image

@Anthrino
Copy link
Contributor

Anthrino commented Jan 4, 2019

Hi @TaggerTie , sorry for the delay in response.
Could you please pull the latest version of the repo and rerun the application.
I have pushed a couple of patches attempting to fix this issue, please report if you are facing the same errors.

@TaggerTie
Copy link

TaggerTie commented Jan 4, 2019

Hi Anthrino, thanks for your answer. Is there any change in the source code after 19th Oktober 2018? Because i did my installation and the gitclone in the middle of November 2018 so i guess i have the latest repo.

i did a "git pull" today, And as i guess i am "Already up-todate"

the App crashes again at line 258
image

Error 1: TypeError: Cannot read property '0' of undefined
at /home/it/kea-anterius/app.js:258:135

@TaggerTie
Copy link

:( :( :(

@Anthrino
Copy link
Contributor

@TaggerTie Apologies for the delay, I had committed a patch previously to resolve this issue, unable to reproduce the error. Please allow some time to have this bug rectified.

@TaggerTie
Copy link

Thanks, please let me know if you need further information of my setup

@TaggerTie
Copy link

Does anybody else have a working KEA-Antherius Setup from which i can compare some Settings?

@satishdotpatel
Copy link

satishdotpatel commented Mar 9, 2020

I am also getting this error and not sure what to do, i can access GUI but its not able to talk to CA
I am running kea 1.6 with MySQL DB

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants