NorthernMan54 / homebridge-alexa

Expose your homebridge controlled devices to Amazon Alexa.
https://www.homebridge.ca
442 stars 77 forks source link

Unexpected end of JSON input #508

Closed alexwala closed 2 years ago

alexwala commented 2 years ago

Got error - leads to restart of homebridge:

[3/23/2022, 7:08:55 AM] SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at _sendHapEvent (/usr/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/lib/eventedHttpClient.js:102:24)
    at Socket.<anonymous> (/usr/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/lib/eventedHttpClient.js:69:11)
    at Socket.emit (node:events:520:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
[3/23/2022, 7:08:55 AM] Got SIGTERM, shutting down Homebridge...
NorthernMan54 commented 2 years ago

Well that obviously didn’t work

I will take another crack as this later today.

As these are messages from HomeKit devices aka homebridge, what version of homebridge are you running?

And are you running any other none native HomeKit devices?

On Mar 23, 2022, at 4:21 AM, alexwala @.***> wrote:

 Got error - leads to restart of homebridge:

[3/23/2022, 7:08:55 AM] SyntaxError: Unexpected end of JSON input at JSON.parse () at _sendHapEvent (/usr/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/lib/eventedHttpClient.js:102:24) at Socket. (/usr/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/lib/eventedHttpClient.js:69:11) at Socket.emit (node:events:520:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at Socket.Readable.push (node:internal/streams/readable:228:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) [3/23/2022, 7:08:55 AM] Got SIGTERM, shutting down Homebridge... — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

alexwala commented 2 years ago

I am using homebridge v1.4.0 Currently only none native HomeKit devices in use.

NorthernMan54 commented 2 years ago

Attempt # 2 is published at v0.5.58, and it should no longer trigger homebridge crashes. It will also log a lot more detail when the same data condition occurs.

alexwala commented 2 years ago

thx !

alexwala commented 2 years ago

will there be a new version ?

NorthernMan54 commented 2 years ago

Any repeats or log messages?

alexwala commented 2 years ago

acually on v0.5.56 ... hm have to check plugin in homebridge

[3/25/2022, 5:59:59 AM] SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at _sendHapEvent (/usr/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/lib/eventedHttpClient.js:102:24)
    at Socket.<anonymous> (/usr/lib/node_modules/homebridge-alexa/node_modules/hap-node-client/lib/eventedHttpClient.js:69:11)
    at Socket.emit (node:events:526:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
NorthernMan54 commented 2 years ago

It should no longer crash with 0.5.58 and will log details on the message received to further debug this

alexwala commented 2 years ago

hm currently i do not get any 0.5.58 version - only 0.5.56, maybe isn't published ?

alexwala commented 2 years ago

ok now there is a 0.5.60...will let you know if error occurs again- - thx

NorthernMan54 commented 2 years ago

I just pushed 0.5.60 and 0.5.61 ( made a typo in CHANGELOG with 0.5.60 )

alexwala commented 2 years ago

thanks for the quick support !

NorthernMan54 commented 2 years ago

No problem, I was doing other things this AM and needed to re-publish anyway. Not sure why 0.5.58 wasn’t listed

On Mar 25, 2022, at 10:03 AM, alexwala @.***> wrote:

thanks for the quick support !

— Reply to this email directly, view it on GitHub https://github.com/NorthernMan54/homebridge-alexa/issues/508#issuecomment-1079058810, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEXEFGDMVKQHOOKXY7RZRB3VBXBSVANCNFSM5RNHMDXA. You are receiving this because you commented.

alexwala commented 2 years ago

got error again on main homebridge instance (192.168.0.100, homebridge-alex installed) :) 192.168.0.101 is another homebridge instance running on a RpiA (connected via wifi)

Error: _sendHapEvent Unexpected end of JSON input http://192.168.0.101:34653/characteristics {
  protocol: 'EVENT',
  httpVersion: 1,
  statusCode: 200,
  statusMessage: 'OK',
  method: null,
  url: 'http://192.168.0.101:34653/',
  headers: { 'Content-Type': 'application/hap+json', 'Content-Length': 50 },
  body: '{"characteristics":[{"aid":1,"ii',
  boundary: null,
  multipart: null,
  additional: ''
}
NorthernMan54 commented 2 years ago

Did it crash this time ?

This is what triggered the earlier crashes

body: '{"characteristics":[{"aid":1,"ii',

It should be a complete message and it is cut off

Can you supply more details on the version of home bridge running here, and what plugin this is from ?

http://192.168.0.101:34653

I want to attempt to duplicate the condition

alexwala commented 2 years ago

No crash this time :)

I think the homebridge connected via wifi (192.168.0.101) do sometimes a reconnect:

avahi-daemon[325]: Withdrawing address record for 192.168.0.101 on wlan0
dhcpcd[483]: wlan0: rebinding lease of 192.168.0.101

main homebridge (192.168.0.100, connected via wire):

System Information
Timezone    GMT+0100
OS      Raspbian GNU/Linux Buster (10)
Hostname    raspberrypi
IPv4 (eth0) 192.168.1.100
Node.js Version v16.14.2
Npm Version v8.5.0
User        pi
Storage Path    /var/lib/homebridge
Config Path /var/lib/homebridge/config.json
Service Mode    Yes

multiple accessories/platforms

second homebridge (192.168.0.101, connected via wifi):

System Information
Timezone    GMT+0100
OS      Raspbian GNU/Linux Buster (10)
Hostname    raspberrypi
IPv4 (eth0) 192.168.1.101
Node.js Version v16.14.2
Npm Version v8.5.0
User        pi
Storage Path    /var/lib/homebridge
Config Path /var/lib/homebridge/config.json
Service Mode    Yes

2 accessories/platforms: raspberry_simple_gpio, Camera-ffmpeg

will try to disable plugin one by one and check log for errors

NorthernMan54 commented 2 years ago

I have been trying to recreate this without any luck, any more error messages, hopefully that are a bit different