Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: unexpected response (4.00) to observeScene(169275, 200468) #36

Open
CliffS opened this issue Mar 7, 2018 · 16 comments
Open

Error: unexpected response (4.00) to observeScene(169275, 200468) #36

CliffS opened this issue Mar 7, 2018 · 16 comments
Assignees
Labels
bug needs info Needs more information to decide or work on this

Comments

@CliffS
Copy link

CliffS commented Mar 7, 2018

Seeing a lot of error events in long-running code.

Error: unexpected response (4.00) to observeScene(169275, 200468).
    at TradfriClient.observeScene_callback (/home/cliff/src/git/house/node_modules/node-tradfri-client/build/tradfri-client.js:456:36)
    at PendingRequest.handleResponse [as callback] (/home/cliff/src/git/house/node_modules/node-tradfri-client/build/tradfri-client.js:415:41)
    at Function.onMessage (/home/cliff/src/git/house/node_modules/node-coap-client/build/CoapClient.js:606:33)
    at SocketWrapper.emit (events.js:127:13)
    at SocketWrapper.socket.on (/home/cliff/src/git/house/node_modules/node-coap-client/build/lib/SocketWrapper.js:12:18)
    at Socket.emit (events.js:127:13)
    at Socket.udp_onMessage (/home/cliff/src/git/house/node_modules/node-dtls-client/build/dtls.js:204:34)
    at Socket.emit (events.js:127:13)
    at UDP.onMessage (dgram.js:659:8)

Should I care? Or should I just be ignoring them?

@AlCalzone
Copy link
Owner

Did you delete a scene? I guess I should not log an error for that response code.

@AlCalzone AlCalzone self-assigned this Mar 7, 2018
@AlCalzone AlCalzone changed the title Error: unexpected response (4.00) to observeScene(169275, 200468). Do not log errors when receiving code 4.00 to an observed resource Mar 7, 2018
@AlCalzone AlCalzone changed the title Do not log errors when receiving code 4.00 to an observed resource Error: unexpected response (4.00) to observeScene(169275, 200468) Mar 7, 2018
@CliffS
Copy link
Author

CliffS commented Mar 7, 2018

No scenes deleted or otherwise changed. But I agree with your proposed solution. :)

@AlCalzone
Copy link
Owner

Oh I mistook code 4.00 for 4.04. I'll enhance the log for those to find out why its happening.

@CliffS
Copy link
Author

CliffS commented Mar 7, 2018

Also getting 4.08s. I hadn't noticed that some are 4.00 and some are 4.08. You already ignore 4.04s.

@AlCalzone
Copy link
Owner

Ok, please check your logs with this version: c6a6967

@AlCalzone
Copy link
Owner

4.08 means Request Entity Incomplete - this is due to an incomplete implementation of RFC 7959, see AlCalzone/node-coap-client#23

Some traffic logs would be nice to find out whats being sent and why its incomplete.

@CliffS
Copy link
Author

CliffS commented Mar 7, 2018

Right. I've set everything up with links and updated everything. I'll let you know what happens.

Thanks.

@CliffS
Copy link
Author

CliffS commented Mar 9, 2018

Since running on the c6a6967 code, I have not seen this issue. Does that mean you've fixed it?

@AlCalzone
Copy link
Owner

Can't be as the errors come from node-coap-client and I only added logs to node-tradfri-client. Guess you'll have to continue watching.

@CliffS
Copy link
Author

CliffS commented Mar 15, 2018

I've been unable to reproduce this so I'm closing this issue for the time being. If it reappears with the latest code, I'll reopen it.

Thanks.

@CliffS CliffS closed this as completed Mar 15, 2018
@CliffS
Copy link
Author

CliffS commented Dec 25, 2019

This has suddenly started happening again after I upgraded recently. I'm current running the v2.1.0 release of node-tradfri-client. The log is as follows:

Dec 25 09:12:27 pi npm[4465]: /opt/cliff/src/git/house/node_modules/ikea-tradfri/lib/Tradfri.js:96
Dec 25 09:12:27 pi npm[4465]:                   throw err;
Dec 25 09:12:27 pi npm[4465]:                   ^
Dec 25 09:12:27 pi npm[4465]: Error: unexpected response (4.00) to observeDevice(65541): [object Object]
Dec 25 09:12:27 pi npm[4465]:     at TradfriClient.handleNonSuccessfulResponse (/opt/cliff/src/git/house/node_modules/node-tradfri-client/build/tradfri-client.js:750:32)
Dec 25 09:12:27 pi npm[4465]:     at TradfriClient.observeDevice_callback (/opt/cliff/src/git/house/node_modules/node-tradfri-client/build/tradfri-client.js:389:23)
Dec 25 09:12:27 pi npm[4465]:     at PendingRequest.handleResponse [as callback] (/opt/cliff/src/git/house/node_modules/node-tradfri-client/build/tradfri-client.js:346:41)
Dec 25 09:12:27 pi npm[4465]:     at Function.onMessage (/opt/cliff/src/git/house/node_modules/node-coap-client/build/CoapClient.js:631:33)
Dec 25 09:12:27 pi npm[4465]:     at SocketWrapper.emit (events.js:188:13)
Dec 25 09:12:27 pi npm[4465]:     at SocketWrapper.socket.on (/opt/cliff/src/git/house/node_modules/node-coap-client/build/lib/SocketWrapper.js:12:18)
Dec 25 09:12:27 pi npm[4465]:     at Socket.emit (events.js:188:13)
Dec 25 09:12:27 pi npm[4465]:     at Socket.udp_onMessage (/opt/cliff/src/git/house/node_modules/node-dtls-client/build/dtls.js:189:34)
Dec 25 09:12:27 pi npm[4465]:     at Socket.emit (events.js:188:13)
Dec 25 09:12:27 pi npm[4465]:     at UDP.onMessage (dgram.js:685:8)

Merry Christmas! :)

@CliffS CliffS reopened this Dec 25, 2019
@AlCalzone
Copy link
Owner

Sorry to take so long, but you probably know where my priorities are right now. I'll need a tcpdump to understand whats going on, which must include the connection initiation. I usually set it up with a filter on port 5684 to only capture the CoAP traffic. And I'll need your connection credentials to decrypt the communication.

@AlCalzone AlCalzone added the needs info Needs more information to decide or work on this label Feb 3, 2020
@AlCalzone
Copy link
Owner

Can you try again with the latest version of this library? I've identified an issue with expiring credentials - maybe that is the root cause of this issue. The lib now tries to automatically re-authenticate, therefore you should always call authenticate(...) and then connect with the fresh credentials so the lib knows your security code.

@CliffS
Copy link
Author

CliffS commented Apr 14, 2020

Just seen this again after all this time. It is consistent if I edit a scene in the Android app and happens on save:

Apr 14 11:29:07 pi npm[9533]: /opt/cliff/src/git/house/node_modules/ikea-tradfri/lib/Tradfri.js:96
Apr 14 11:29:07 pi npm[9533]:                   throw err;
Apr 14 11:29:07 pi npm[9533]:                   ^
Apr 14 11:29:07 pi npm[9533]: Error: unexpected response (4.00) to observeScene(131073, 196621):
Apr 14 11:29:07 pi npm[9533]:     at TradfriClient.handleNonSuccessfulResponse (/opt/cliff/src/git/house/node_modules/node-tradfri-client/build/tradfri-client.js:783:32)
Apr 14 11:29:07 pi npm[9533]:     at TradfriClient.observeScene_callback (/opt/cliff/src/git/house/node_modules/node-tradfri-client/build/tradfri-client.js:631:23)
Apr 14 11:29:07 pi npm[9533]:     at PendingRequest.handleResponse [as callback] (/opt/cliff/src/git/house/node_modules/node-tradfri-client/build/tradfri-client.js:595:41)
Apr 14 11:29:07 pi npm[9533]:     at Function.onMessage (/opt/cliff/src/git/house/node_modules/node-coap-client/build/CoapClient.js:631:33)
Apr 14 11:29:07 pi npm[9533]:     at SocketWrapper.emit (events.js:188:13)
Apr 14 11:29:07 pi npm[9533]:     at SocketWrapper.socket.on (/opt/cliff/src/git/house/node_modules/node-coap-client/build/lib/SocketWrapper.js:12:18)
Apr 14 11:29:07 pi npm[9533]:     at Socket.emit (events.js:188:13)
Apr 14 11:29:07 pi npm[9533]:     at Socket.udp_onMessage (/opt/cliff/src/git/house/node_modules/node-dtls-client/build/dtls.js:189:34)
Apr 14 11:29:07 pi npm[9533]:     at Socket.emit (events.js:188:13)
Apr 14 11:29:07 pi npm[9533]:     at UDP.onMessage (dgram.js:685:8)

This is with node-tradfri-client version v2.1.4.

@AlCalzone
Copy link
Owner

Good to know! I'll see if I can reproduce it.

@AlCalzone AlCalzone removed the needs info Needs more information to decide or work on this label Apr 14, 2020
@AlCalzone
Copy link
Owner

@CliffS I guess I still need some info. I've tried with the following code:

// @ts-check

const { TradfriClient, discoverGateway } = require("../../build");
const { wait } = require("alcalzone-shared/async");

async function main() {
	const gwinfo = await discoverGateway();

	const tradfri = new TradfriClient(
		gwinfo.addresses[0],
		(msg, sev) => sev !== "silly" && console.error(msg)
	);

	tradfri.on("error", (err) => console.error(err));

	await tradfri.connect( /* my identity */, /* my PSK */);

	await tradfri.observeGroupsAndScenes();

	await wait(180000);

	tradfri.destroy();
}
main();

and added, edited and deleted a scene while the script was running. Did not see anything error-like. Can you try to provide a minimal example which reproducibly causes the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs info Needs more information to decide or work on this
Projects
None yet
Development

No branches or pull requests

1 participant