binarybucks / homA

An extensible framework for the smart home
Eclipse Public License 1.0
137 stars 25 forks source link

A small bouquet of issues, probably all home made #107

Closed jpmens closed 11 years ago

jpmens commented 11 years ago

I've just pulled a fresh copy of homA, and am experiencing some things I don't quite understand. They may all be inter-related, which is why I'm dumping it all into this one ticket. Please forgive me.

  1. I launch a copy of WSS_static_osx from https://github.com/stylpen/WSS. I seem to recall a note somewhere that the default port was changed from 1337, but this version still uses that. Am I using the correct code?
  2. Safari doesn't show the cog wheel on top right in the webinterface component; Chrome does (both OSX)
  3. Trying the new weather component, I see the topics are published and retained. If I stop weather and do a SUB, I clearly see the retained messages:
mosquitto_sub -v -t '/devices/383274-weather/#'
/devices/383274-weather/controls/Now 30.46°C Clear
/devices/383274-weather/controls/Now/meta/type text
/devices/383274-weather/controls/Now/meta/order 0
/devices/383274-weather/controls/Today 31.6°C 33.93°C 32.04°C
/devices/383274-weather/controls/Today/meta/type text
/devices/383274-weather/controls/Today/meta/order 2
/devices/383274-weather/controls/Tomorrow 26.26°C 32.83°C 29.88°C
/devices/383274-weather/controls/Tomorrow/meta/type text
  1. With a stopped weather component, and in spite of having above retained messages, if I refresh Chrome Web browser, I see the following

jmbp-622

That doesn't correspond to my understanding of how the webinterface component of homA works. By the way, a similar 'corrupt' output happens if I use the demo interface and then refresh Chrome

jmbp-623

It appears to be a Web interface thing.

What am I doing wrong?

jpmens commented 11 years ago

I saw this message on the terminal in which WSS was running:

2013-06-17T16:04:02 [16] Unexpected EOF from remote endpoint, terminating connection.

and a few moments later:

Segmentation fault: 11  ../../../WSS/WSS_static_osx

I cannot reproduce that at will, though.

binarybucks commented 11 years ago

Hey, thanks for the bug hunting. I'll see what I can do:

1) You're probably using the right code. Just make sure you use the mqtt branch, as the master branch contains more generic code that does not work with the new PahoJs Mqtt library (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=407909 for more details). The WSS default port is still 1337 as @stylpen hasn't yet changed the default port to something more MQTT specific. Meanwhile, I've updated the webinterface readme to set the websocketPort to 1884.

2) Thanks, that was a css bug

3) The Loading... appears when a meta/type message has not yet been received for a control. As your retained messages look good from what I can tell you're probably right that this is a webinterface issue. Could you past the log here? You can enable debug output in Chrome on OSX by going to View>Developer>Developer Console, Going to the Resources Tab, Selecting the Webinterface Local Storage from the sidebar, Right clicking into the table and adding a new key logging with the value 1. Afterwards reload the page and open the Javascript console by going to View>Developer>Javascript Console.

I guess that you're not using the mqtt branch of the websocket server which leads to corrupted messages.

Please note, that I distributed the wrong websocket server binaries (the ones not compatible with Paho Js) before yesterday evening. Something apparently went wrong when I merged the pahojs branch into the master branch, so the wrong version ended up in master. This is fixed now.

Edit: the Unexpected EOF from remote endpoint, terminating connection is ok and results from a not properly closed websocket connection when you e.g. reload the window. The segfault however should not happen. Could you check with the latest distributed wss build?

jpmens commented 11 years ago

You, Sir, rock! :-)

  1. Now using WSS_static_osx from 'mqtt' branch, which indeed lasts longer. By hitting browser refresh a dozen times, I still get it to segfault, though. (But who, other than I, would do THAT?! :-)
  2. I confirm CSS issue fixed.
  3. I'll omit this for the time being, as the interface now looks how I expected it to look.

In other words, there's still a bit of a problem with WSS, but other than that, it all looks good for me.

Thank you.

binarybucks commented 11 years ago

Uhm, we for once we're hitting refresh like mad to see if we can get WSS to crash. I guess @stylpen will not be pleased to hear it, but I'll give him a heads up so we can get that fixed.

I've created https://github.com/stylpen/WSS/issues/8 for that.

binarybucks commented 11 years ago

I was unable to reproduce the segfault with the OSX version, no matter how much I refresh the page.

Could you try to crash this (https://www.dropbox.com/s/52mrvnmtup99d9e/WSS_osx_static_debug) freshly compiled version which is a bit more verbose?

Edit: Nvm it crashed, just needed some time

stylpen commented 11 years ago

I'll have a look at it when I'm back home in a couple of minutes. Hopefully the osx version was just not build from the latest code in Alex' fork (Alex builds the osx binaries for me). If it was, then I have to dig deeper! Anyway, thanks for reporting!

jpmens commented 11 years ago

You wish, is my segfault:

received message body from broker 43 bytes: 00 1e 2f 64 65 76 69 63 65 73 2f 32 39 33 37 32 33 2d 64 65 6d 6f 2f 6d 65 74 61 2f 6e 61 6d 65 44 65 6d 6f 2d 44 65 76 69 63 65
plaintext: /devices/293723-demo/meta/nameDemo-Device
started async TCP read
received header from broker.
Length: 2 Bytes
Payload: 31 2e

the remaining message length is: 46

received message body from broker 46 bytes: 00 21 2f 64 65 76 69 63 65 73 2f 32 39 33 37 32 33 2d 64 65 6d 6f 2f 6d 65 74 61 2f 6e 61 6d 65 2f 6f 6e 44 65 6d 6f 2d 44 65 76 69 63 65
plaintext: !/devices/293723-demo/meta/name/onDemo-Device
started async TCP read
received header from broker.
Length: 2 Bytes
Payload: 31 29

the remaining message length is: 41

received message body from broker 41 bytes: 00 1e 2f 64 65 76 69 63 65 73 2f 32 39 33 37 32 33 2d 64 65 6d 6f 2f 6d 65 74 61 2f 72 6f 6f 6d 44 65 6d 6f 2d 52 6f 6f 6d
plaintext: /devices/293723-demo/meta/roomDemo-Room
started async TCP read
received header from broker.
Length: 2 Bytes
Payload: 31 2c

the remaining message length is: 44

received message body from broker 44 bytes: 00 21 2f 64 65 76 69 63 65 73 2f 32 39 33 37 32 33 2d 64 65 6d 6f 2f 6d 65 74 61 2f 72 6f 6f 6d 2f 6f 6e 44 65 6d 6f 2d 52 6f 6f 6d
plaintext: !/devices/293723-demo/meta/room/onDemo-Room
started async TCP read
received from websocket: �
sent TCP segment to broker 2 bytes: ffe0 00
plaintext: �
destructor websocket: 0x7fba79c0a810 connection 0x7fba79c0a170
stopped async TCP receive
closing connection and deleting corresponding handler. number of handlers left:1
stopped receiving header
0 bytes arrived so far. error asio.misc:2 websocket: 0x8000000000000000 connection 0x7fba79c0a170

Segmentation fault: 11
binarybucks commented 11 years ago

This should fix all issues. Please reopen if you manage to kill WSS again ;)